in reply to Regexp for range of numbers
use strict; use warnings; my @nums = (100,-3,150,-2,-1,256, 280, 254);; foreach my $n (@nums) { print "$n: ", ($n !~ /^1?\d{1,2}$|^2(?:[0-4]\d|5[0-5])$/) ? 'fail' : 'pass'; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regexp for range of numbers
by Anonymous Monk on Apr 05, 2005 at 12:54 UTC |