Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

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

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

Replies are listed 'Best First'.
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://244337]
[ambrus]: Corion: I didn't want to start this particular computer up, I took this one away so that I can put the other computer I want to start up in its place, but that probably doesn't make much of a difference.

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2017-01-16 19:52 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (151 votes). Check out past polls.