mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
simpler regex suggested by @MichaIng
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
parent
011fa8c6ea
commit
fe30ce10d3
1 changed files with 1 additions and 1 deletions
|
@ -1018,7 +1018,7 @@ valid_ip() {
|
||||||
local stat=1
|
local stat=1
|
||||||
|
|
||||||
# If the IP matches the format xxx.xxx.xxx.xxx (optional port of range #0-65536), also ensure string ends with 0-9
|
# If the IP matches the format xxx.xxx.xxx.xxx (optional port of range #0-65536), also ensure string ends with 0-9
|
||||||
if [[ "${ip}" =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}#{0,1}[0-9]{0,5}$ && "${ip}" =~ ^.*[0-9]$ ]]; then
|
if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}(#[0-9]{1,5})?$ ]]; then
|
||||||
# Save the old Internal Field Separator in a variable
|
# Save the old Internal Field Separator in a variable
|
||||||
OIFS=$IFS
|
OIFS=$IFS
|
||||||
# and set the new one to a dot (period)
|
# and set the new one to a dot (period)
|
||||||
|
|
Loading…
Reference in a new issue