Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Re: Detect presence of numbers 1-9

by Juerd (Abbot)
on Apr 08, 2002 at 09:37 UTC ( #157397=note: print w/replies, xml ) Need Help??


in reply to Re: Detect presence of numbers 1-9
in thread Detect presence of numbers 1-9

if ( $scalar =~ /^[12345]+$/ ) {

Please note that $ also matches before a trailing \n character, and that this regex also matches "111\n". But I'd go for the negative match anyway, because it seems more natural to me.

U28geW91IGNhbiBhbGwgcm90MTMgY
W5kIHBhY2soKS4gQnV0IGRvIHlvdS
ByZWNvZ25pc2UgQmFzZTY0IHdoZW4
geW91IHNlZSBpdD8gIC0tIEp1ZXJk

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2021-06-21 00:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (97 votes). Check out past polls.

    Notices?