[tpm] Greedy regex question
linux at alteeve.com
Fri Feb 29 08:07:19 PST 2008
Given the string:
$val="0 (0x0) (int)";
Properly, ungreedily, return "0 (int)" *but*, changing it to:
Wrongly, greedily, return "0 "? When I put the '.*?' in brackets and
print '$1' on the later it is indeed grabbing "0x0) (int".
What is it about anchoring the regex to the end of the string cause
it to be a greedy regex again? As you can probably gather, I am trying
to get rid of /only/ the last '(foo)' in a given string.
More information about the toronto-pm