Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Match a Range of IP's

by si_lence (Deacon)
on Sep 30, 2004 at 16:18 UTC ( #395395=note: print w/replies, xml ) Need Help??


in reply to Match a Range of IP's

Hello

You are using a character class in your match.
[1-99] means a "1" to "9" and excatly one of it.

To select only one or two digit number use somethin like
print "$_\n" if /192\.168\.\d\d?\.\d+/g
si_lence Update: bpphillips is right with his answer (shame on me!), so I changed the description.
At least the regex was ok ;-)

Replies are listed 'Best First'.
Re^2: Match a Range of IP's
by bpphillips (Friar) on Sep 30, 2004 at 16:22 UTC
    actually, within a character class, a "-" character indicates a range unless it's at the beginning or the end of the character class

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2021-01-17 13:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?