Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Don't Use Regular Expressions To Parse IP Addresses!

by dws (Chancellor)
on Dec 21, 2002 at 02:24 UTC ( #221555=note: print w/replies, xml ) Need Help??


in reply to Don't Use Regular Expressions To Parse IP Addresses!

Regular expressions should not be used to parse IP addresses because IP addresses can be expressed in several forms...

"Yes, but..."

There are plenty of situations, such as parsing server logfiles, where four-part IP addresses are a given. In these cases, using a regex is just fine.

The only case I've actually run across in practice where using a regex isn't safe is when parsing URLs where some spammer has obscured an IP address by using a non-standard forms.

  • Comment on Re: Don't Use Regular Expressions To Parse IP Addresses!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://221555]
help
Chatterbox?
[hippo]: Anyone able to get to https://deps. cpantesters.org/? Not even getting a connection from here.
[choroba]: Down for everyone of just me
[shmem]: "Problem loading page" here
[marto]: seems down
[planetscape]: Able to ping but not connect with either Opera or Firefox
[thanos1983]: same here...
[choroba]: marto ;-)
[Discipulus]: after an error now is back
[shmem]: looks like a 302 loop - "The document has moved here"
[Discipulus]: ..but only http not https

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (13)
As of 2018-02-20 11:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (271 votes). Check out past polls.

    Notices?