Perl/Shell Knowledge Sharing
Perl Interview Questions and Answers
Thursday, August 4, 2011
Perl : Numeric Range Pattern Matching (IP)
$ip=~/(\d+)\.(\d+)\.(\d+)\.(\
d+)/;
if ($1>=0 && $1<=255 && $2>=0 && $2<=255 && $3>=0 && $3<=255 && $4>=0
&& $4<=255)
{
}
OR
$ip=~/\b((2[0-5][0-5]\.)|(1?[
0-9]?[0-9]\.)){3}((2[0-5][0-5]
)|(1?[0-9]?[0-9]))\b/
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment