in reply to Regex Minimal Quantifiers
\d* also matches 0 digits
resultmy $str = "I have 2 numbers: 53147"; if ( $str =~ /(.*?)(\d+)/ ) { print "<$1> <$2>\n"; } else { print "FAIL\n"; }
<I have > <2>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex Minimal Quantifiers
by pr33 (Scribe) on May 24, 2017 at 05:14 UTC |