From fe30ce10d361c5ceb823aa88131caf03bdab0e6e Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 15 Jun 2020 21:21:40 +0100 Subject: [PATCH] simpler regex suggested by @MichaIng Signed-off-by: Adam Warner --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 4352c578..0b2ddef1 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1018,7 +1018,7 @@ valid_ip() { 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 [[ "${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 OIFS=$IFS # and set the new one to a dot (period)