Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Re: Regex for IP and Optional Port

by spaz (Pilgrim)
on Jan 17, 2002 at 04:03 UTC ( [id://139392]=note: print w/replies, xml ) Need Help??


in reply to (shockme) Re: Regex for IP and Optional Port
in thread Regex for IP and Optional Port

Keep in mind that a valid IP address is matched by this beast, as found in the Ram Book:
m/^([01]?\d\d|2[0-4]\d|25[0-5])\.([01]?\d\d|2[0-4]\d|25[0-5])\. ([01]?\d\d|2[0-4]\d|25[0-5])\.([01]?\d\d|2[0-4]\d|25[0-5])$/;
Since this is a rather unwieldy expression, and rather static, it should be quite easy to compile it once with qr// and insert it as needed.

-- Dave

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-03-28 22:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found