Your update is completely wrong. '123' =~ /(.*)(\d)/ will match just fine. If .* matches too many characters for \d to match, backtracking will occur causing .* to match fewer characters.
'123' =~ /(.*)(\d)/ (12)(3) '123' =~ /(.*?)(\d)/ ()(1) 'a123z' =~ /(.*)(\d)/ (a12)(3) 'a123z' =~ /(.*?)(\d)/ (a)(1)
In reply to Re^2: Is there any other way to avoid greedy matching
by ikegami
in thread Is there any other way to avoid greedy matching
by krissmercedes
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |