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

Re: Match a Range of IP's

by conrad (Beadle)
on Sep 30, 2004 at 16:15 UTC ( [id://395391]=note: print w/replies, xml ) Need Help??


in reply to Match a Range of IP's

[1-99] is a character range, not a number range, so it'll match 1 .. 9 or 9 (i.e. it's the same as [1-9]).

One solution is to use [1-9]\d? instead, which will match 1 .. 9 and any two-digit number (but if you ever get IP addresses of the form "001" this will fail).

A better option would be to use (\d+) and add " && $1 >= 1 && $1 <= 99" to the end of the line; bear in mind that that will run into trouble if you have multiple IP addresses per line because of your /g though...

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-25 13:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found