THRAK has asked for the wisdom of the Perl Monks concerning the following question:
As shown here this produces:#!/usr/bin/perl -w use strict; my @stuff = qw(1234 a12345 12345 12345z); foreach my $num (@stuff) { unless ($num =~ /^\d{5,}/) { print "Not Valid: $num\n"; } else { print "Valid: $num\n"; } }
I know this shouldn't be difficult, but I've hit a mental roadblock so any help would be appreciated./^\d{5,}\D+/ #invalidates all except "12345z" /^\d{5,}|\D+/ #only "1234" invalid
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex Pattern Problem
by danger (Priest) on Feb 28, 2001 at 02:49 UTC | |
|
Re: Regex Pattern Problem
by arturo (Vicar) on Feb 28, 2001 at 02:53 UTC | |
|
Re: Regex Pattern Problem
by ZZamboni (Curate) on Feb 28, 2001 at 02:53 UTC | |
|
Re: Regex Pattern Problem
by myocom (Deacon) on Feb 28, 2001 at 02:48 UTC | |
by THRAK (Monk) on Feb 28, 2001 at 17:49 UTC | |
|
(boo) Re: Regex Pattern Problem
by boo_radley (Parson) on Feb 28, 2001 at 02:50 UTC | |
|
Re: Regex Pattern Problem
by Yoda (Sexton) on Feb 28, 2001 at 07:03 UTC | |
|
Re: Regex Pattern Problem
by aardvark (Pilgrim) on Feb 28, 2001 at 03:30 UTC | |
|
Re: Regex Pattern Problem
by sierrathedog04 (Hermit) on Feb 28, 2001 at 17:30 UTC |