From da4cc1ced52e28107e30967da0e7a6dd4c304369 Mon Sep 17 00:00:00 2001 From: Rob Gill Date: Mon, 14 Oct 2019 19:59:00 +1000 Subject: [PATCH] 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 --- auto_install/install.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/auto_install/install.sh b/auto_install/install.sh index ac2e190..1ff0cc9 100755 --- a/auto_install/install.sh +++ b/auto_install/install.sh @@ -389,8 +389,7 @@ function valid_domain() local domain=$1 local stat=1 - - if [[ $domain =~ ^[a-zA-Z0-9][a-zA-Z0-9-]{1,61}\.[a-zA-Z]{2,}$ ]]; then + 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 stat=$? fi return $stat