Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Regex Minimal Quantifiers

by huck (Prior)
on May 24, 2017 at 04:54 UTC ( [id://1191047]=note: print w/replies, xml ) Need Help??


in reply to Regex Minimal Quantifiers

\d* also matches 0 digits

my $str = "I have 2 numbers: 53147"; if ( $str =~ /(.*?)(\d+)/ ) { print "<$1> <$2>\n"; } else { print "FAIL\n"; }
result
<I have > <2>

Replies are listed 'Best First'.
Re^2: Regex Minimal Quantifiers
by pr33 (Scribe) on May 24, 2017 at 05:14 UTC

    Thanks Huck

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (9)
As of 2024-03-28 11:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found