No such thing as a small change | |
PerlMonks |
Re^3: Match variables : Beginner in perl -- webperlby jbodoni (Monk) |
on Jan 03, 2019 at 11:26 UTC ( [id://1227964]=note: print w/replies, xml ) | Need Help?? |
Regex greediness: If you want to find the string one two three in "one two three" "four five six", your first thought might be to use m/"(.*)"/ This will return one two three" "four five six because the regex will match as many characters as it can. It will match until the last " it finds. Instead, use m/"(.*?)"/, which will stop matching as soon as it can.
In Section
Seekers of Perl Wisdom
|
|