Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

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]
stevieb is writing a little CUFP on how to control analog pins on an arduino from a Linux machine via I2C in light of Perl, JavaScript and Strandbeests. It also is a good real-world use-case to test my I2C dist.
[stevieb]: I just don't feel like going hardcore on anything today, so I thought I'd *use* my software instead of just write it

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2017-07-21 23:24 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (336 votes). Check out past polls.