![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Regular Expressions | ramky79 | UNIX for Advanced & Expert Users | 3 | 05-21-2008 02:13 PM |
| regular expressions | melanie_pfefer | UNIX for Dummies Questions & Answers | 8 | 04-10-2008 01:24 AM |
| Develop and Test Regular Expressions with a Unit Testing Package | iBot | Oracle Updates (RSS) | 0 | 04-06-2008 02:10 AM |
| regular expressions | whatever | Shell Programming and Scripting | 4 | 05-20-2007 01:30 PM |
| regular expressions | ragha81 | UNIX for Dummies Questions & Answers | 2 | 03-05-2007 04:24 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
lam taking the IP address as input from the user. I want to test whether the user has entered the IP address in the right format or not. Can any one suggest me the syntax to test the user given IP address ASAP. Its a bit urgent. Regards, |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
this could help you:
How to validate an IP address |
|
#3
|
|||
|
|||
|
Code:
o1='1[0-9]{0,2}|2([6-9]|[0-4][0-9]?|5[0-4]?)?|[3-9][0-9]?'
o0='0|255|'"$o1"
if echo "$ip" | egrep -v "^($o1)(\.($o0)){2}\.($o1)$" >/dev/null; then
echo invalid ip
fi
|
|||
| Google The UNIX and Linux Forums |
| Tags |
| regex, regular expressions |
| Thread Tools | |
| Display Modes | |
|
|