Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

ip address regex validate cmd

#!/bin/sh

ip=1.2.3.4

if expr "$ip" : '[0-9][0-9]*.[0-9][0-9]*.[0-9][0-9]*.[0-9][0-9]*$' >/dev/null; then
  echo "success"
else
  echo "fail"
fi
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #ip #address #regex #validate #cmd
ADD COMMENT
Topic
Name
9+8 =