Merge pull request #2302 from dokku/u2mejc-domains-regex

Fix is_valid_hostname regex
This commit is contained in:
Justin Clark
2016-07-08 15:51:45 -07:00
committed by GitHub

View File

@@ -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