fix domain regex, domains can start with numbers
This commit is contained in:
parent
163e7243da
commit
16f1d09722
@ -32,7 +32,7 @@ while getopts "hd:" opt; do
|
||||
d ) # domain name (hostname) to create cert for
|
||||
domain=${OPTARG,,}
|
||||
# basic but good enough domain name regex validation
|
||||
if [[ ! $domain =~ ^(([a-zA-Z](-?[a-zA-Z0-9])*)\.)+[a-zA-Z]{2,}$ ]] ; then
|
||||
if [[ ! $domain =~ ^(([a-zA-Z0-9](-?[a-zA-Z0-9])*)\.)+[a-zA-Z]{2,}$ ]] ; then
|
||||
echo "ERROR: Invalid domain name: $1"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -34,7 +34,7 @@ while getopts "hd:tn" opt; do
|
||||
d ) # domain name (hostname) to create cert for
|
||||
domain=${OPTARG,,}
|
||||
# basic but good enough domain name regex validation
|
||||
if [[ ! $domain =~ ^(([a-zA-Z](-?[a-zA-Z0-9])*)\.)+[a-zA-Z]{2,}$ ]] ; then
|
||||
if [[ ! $domain =~ ^(([a-zA-Z0-9](-?[a-zA-Z0-9])*)\.)+[a-zA-Z]{2,}$ ]] ; then
|
||||
echo "ERROR: Invalid domain name: $1"
|
||||
exit 1
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user