in reply to Regex Pattern Problem
After a little playing around, I came up with this:
#!/usr/bin/perl -w use strict; my @stuff = qw(1234 a12345 12345 12345z 123456); foreach my $num (@stuff) { unless ($num =~ /^\d{5,}$/) { print "Not Valid: $num\n"; } else { print "Valid: $num\n"; } }
Note the $ anchor there...this should match any string of digits that's at least 5 digits long, and it will fail for anything with non-digits in it.
EDIT: Removed the extra crap before the $ anchor.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Regex Pattern Problem
by THRAK (Monk) on Feb 28, 2001 at 17:49 UTC |