in reply to Re: does code help regex match numeric ranges?
in thread does code help regex match numeric ranges?

In production code, it might be worth expanding grinder's regexp to
use warnings; use strict; my @test_values = qw/ 26 231 232 233 234 254 255 256 025 0000 /; my $rx = qr /^ (?: 2 # first digit is a 2 (?: [6-9] # second and _last_ digit is + 6-9 | 5 # or second digit 5 [0-5]? # maybe third and _last_ dig +it 0-5 | [0-4] # or second digit 0-4 \d? # maybe followed by a final +third 0-9 )? | [3-9] # first digit 3-9 \d? # maybe followed by final 0- +9 | 1 # first digit 1 (?: \d\d? # maybe followed by 1 or 2 digi +ts )? | 0 # single-digit 0 ) $/x; foreach my $number ( @test_values ) { print "$number:", ($number =~ /$rx/ ? 'true' : 'false'), "\n", ; }
Which makes it easier to see that leading zeroes, as in 0000 or 025, wouldn't fit. That might be or not a problem, of course.

Krambambuli
---
enjoying Mark Jason Dominus' Higher-Order Perl