Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

ip address regex validate cmd

#!/usr/bin/env bash

ip=1.2.3.4

if [[ $ip =~ ^[0-9]+.[0-9]+.[0-9]+.[0-9]+$ ]]; then
  echo "success"
else
  echo "fail"
fi
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #ip #address #regex #validate #cmd
ADD COMMENT
Topic
Name
5+1 =