in reply to Re^2: Match variables : Beginner in perl -- webperl
in thread Match variables : Beginner in perl
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Match variables : Beginner in perl -- webperl
by dsheroh (Monsignor) on Jan 03, 2019 at 11:40 UTC |