Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Validating IP Address

by Wonko the sane (Deacon)
on May 16, 2007 at 12:21 UTC ( #615758=note: print w/ replies, xml ) Need Help??


in reply to Validating IP Address

This is a variation of one from the Book "Mastering Regular Expressions" by Jeffrey Friedl, which I highly recommend.

unless ( $ip =~ m/^(?:[1]?\d\d?|2[0-4]\d|25[0-5])\. (?:[1]?\d\d?|2[0-4]\d|25[0-5])\. (?:[1]?\d\d?|2[0-4]\d|25[0-5])\. (?:[1]?\d\d?|2[0-4]\d|25[0-5])$ /x ) { # do something }
Best Regards,
Wonko


Comment on Re: Validating IP Address
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://615758]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2015-07-05 18:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (67 votes), past polls