From 082e9458e52e80715f23ba84c76564c8e23ff48e Mon Sep 17 00:00:00 2001 From: Kazuhiro NISHIYAMA Date: Thu, 23 May 2019 23:23:10 +0900 Subject: [PATCH] Simplify hostname_regex `[a-z0-9\.\*-]+` includes `\.` and `[a-z0-9\*-]+`. So I think `^([a-z0-9\.\*-]+\.)*[a-z0-9\*-]+$` means last char is `[a-z0-9\*-]` and other optional chars are `[a-z0-9\.\*-]*`. --- plugins/domains/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/domains/functions b/plugins/domains/functions index c724aad33..733db5c9b 100755 --- a/plugins/domains/functions +++ b/plugins/domains/functions @@ -312,7 +312,7 @@ is_global_vhost_enabled() { is_valid_hostname() { declare desc="return 0 if argument is a valid hostname; else return 1" local hostname_string="${1,,}" - local hostname_regex='^([a-z0-9\.\*-]+\.)*[a-z0-9\*-]+$' + local hostname_regex='^[a-z0-9\.\*-]*[a-z0-9\*-]$' if [[ $hostname_string =~ $hostname_regex ]]; then return 0 else