in reply to Re: IP Filtering RegEx needed
in thread IP Filtering RegEx needed
$ perl -le '$_="135.168.995.925"; print "Oops" if /135\.168\.[1-9][0-9 +][0-5]?\.[0-9][0-2]?[0-5]?/' Oops
This is why it's really better to do the range checking outside the regex as others have mentioned.
Update: As is remarked below, if you're sure you're not going to get bogus input from your data then this may not be an issue. It's just something to be aware of when you consider what solution to use (and to keep in the back of your mind for when something breaks and you get bogus results from something like this and can't figure out why . . . :).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: IP Filtering RegEx needed
by Dietz (Curate) on Sep 15, 2004 at 14:50 UTC | |
by Dietz (Curate) on Sep 15, 2004 at 16:17 UTC |