Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
Don't ask to ask, just ask
 
PerlMonks  

Re: specific numbers of digits

by MZSanford (Curate)
on Mar 19, 2003 at 14:11 UTC ( #244337=note: print w/ replies, xml ) Need Help??


in reply to specific numbers of digits

<KISS>

$zip =~ m/\d{5,5}/;
</KISS>
from the frivolous to the serious


Comment on Re: specific numbers of digits
Download Code
Re: Re: specific numbers of digits
by awkmonk (Monk) on Mar 19, 2003 at 14:30 UTC

    Sorry to point this out, but..

    $x = "123456"; if ( $x =~ /\d{5,5}/ ) { print "wrong"; }

    Still matches 123456

    This will do the trick

    $x = "123456"; if ( $x =~ /^\d{5}$/ ) { print "right"; }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://244337]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2014-04-17 08:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (441 votes), past polls