Regex specifies : must start with alphanumeric, may have no more

than two consecutive hyphens, must not end or start with hyphen,
final must be at least two apha characters.

Signed-off-by: Rob Gill <rrobgill@protonmail.com>
This commit is contained in:
Rob Gill 2019-10-14 19:59:00 +10:00
parent 9f20f50e61
commit da4cc1ced5

View file

@ -389,8 +389,7 @@ function valid_domain()
local domain=$1 local domain=$1
local stat=1 local stat=1
if [[ $domain =~ ^(([a-zA-Z0-9]{1,63}|([a-zA-Z0-9]{1,60}[-a-zA-Z0-9()]{0,2}[a-zA-Z0-9]{1,60}))\.){1,6}([a-zA-Z]{2,})$ ]]; then
if [[ $domain =~ ^[a-zA-Z0-9][a-zA-Z0-9-]{1,61}\.[a-zA-Z]{2,}$ ]]; then
stat=$? stat=$?
fi fi
return $stat return $stat