in reply to Regexp for range of numbers
This reads a little nicer, but I don't know whether you'd consider it cheating. It's a Perl regex:
Three digits, then interpolate a scalar ref block that tests what has already matched and returns the rest of the regexp: if the number is too high, the pattern is impossible; otherwise, end-of-string./^(\d{1,3})${\($1 > 255 ? qr(^) : qr($))}/
Update: meant to link to the post, not the poster. So now "solutions in this vein" links to the post.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regexp for range of numbers
by deibyz (Hermit) on Apr 05, 2005 at 16:21 UTC | |
|
Re^2: Regexp for range of numbers
by Anonymous Monk on Apr 05, 2005 at 12:42 UTC | |
by Roy Johnson (Monsignor) on Apr 05, 2005 at 12:55 UTC | |
by Anonymous Monk on Apr 05, 2005 at 14:38 UTC | |
by Roy Johnson (Monsignor) on Apr 05, 2005 at 15:26 UTC |