From d743a27de8fd9c2a7a1f6773083a2ba7b422ca4d Mon Sep 17 00:00:00 2001 From: Justin Clark Date: Thu, 7 Jul 2016 18:11:27 -0700 Subject: [PATCH] Fix is_valid_hostname regex --- plugins/common/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/common/functions b/plugins/common/functions index 09543e77e..459f7c236 100755 --- a/plugins/common/functions +++ b/plugins/common/functions @@ -1067,7 +1067,7 @@ strip_inline_comments() { is_valid_hostname() { declare desc="return 0 if argument is a valid hostname; else return 1" - local hostname_string="$1"; local hostname_regex='^(([a-zA-Z0-9\*](-?[a-zA-Z0-9])*)\.)*[a-zA-Z\*](-?[a-zA-Z0-9])+\.[a-zA-Z]{2,}$' + local hostname_string="${1,,}"; local hostname_regex='^(([a-z0-9\*](-?[a-z0-9])*)\.)*[a-z0-9\*](-?[a-z0-9])+\.[a-z]{2,}$' if [[ $hostname_string =~ $hostname_regex ]]; then return 0 else