File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed
Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -62,11 +62,12 @@ function ascending_wildcard_locations {
6262 # - *.example.com
6363 local domain=" ${1:? } "
6464 local first_label
65- regex=" ^[[:alnum:]_\-]+(\.[[:alpha:]]+)?$"
66- until [[ " $domain " =~ $regex ]]; do
65+ tld_regex=" ^[[:alpha:]]+$"
66+ regex=" ^[^.]+\..+$"
67+ while [[ " $domain " =~ $regex ]]; do
6768 first_label=" ${domain%% .* } "
68- domain=" ${domain/ ${first_label} ./ } "
69- if [[ -z " $domain " ]]; then
69+ domain=" ${domain/# " ${first_label} ." / } "
70+ if [[ " $domain " == " * " || " $domain " =~ $tld_regex ]]; then
7071 return
7172 else
7273 echo " *.${domain} "
@@ -82,11 +83,11 @@ function descending_wildcard_locations {
8283 # - foo.*
8384 local domain=" ${1:? } "
8485 local last_label
85- regex=" ^[[:alnum:]_\- ]+$"
86- until [[ " $domain " =~ $regex ]]; do
86+ regex=" ^.+\.[^. ]+$"
87+ while [[ " $domain " =~ $regex ]]; do
8788 last_label=" ${domain##* .} "
88- domain=" ${domain/ .${last_label} / } "
89- if [[ -z " $domain " ]]; then
89+ domain=" ${domain/% " .${last_label} " / } "
90+ if [[ " $domain " == " * " ]]; then
9091 return
9192 else
9293 echo " ${domain} .*"
You can’t perform that action at this time.
0 commit comments