in reply to Regexp for range of numbers
Of course, with 5.9.2, there is a much nicer way to construct an efficient regular expression to match the numbers from 0 to 255 without leading zeroes:
use strict; my $zero_to_255 = join "|", 0..255; $zero_to_255 = qr(^(?:$zero_to_255)$); print $zero_to_255,"\n"; for (-2,-1, 0..259) { print "$_\n" unless /$zero_to_255/; };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regexp for range of numbers
by 5mi11er (Deacon) on Apr 05, 2005 at 15:52 UTC | |
by Corion (Patriarch) on Apr 05, 2005 at 15:55 UTC | |
by 5mi11er (Deacon) on Apr 05, 2005 at 17:50 UTC | |
by Corion (Patriarch) on Apr 05, 2005 at 20:21 UTC | |
by demerphq (Chancellor) on Apr 06, 2005 at 08:31 UTC |