in reply to Re: Pattern matching
in thread Pattern matching

$s =~ /\\(.*?)$/;

... 4) make that cature non-greedy with the ? -- this way it implicitly makes the \\ be the furthest one to the right in the string.

This is incorrect: greedy or non-greedy, the regexp engine will always try to match the string at a given location any way it can before it proceeds to try at the next location. This will therefore always match the first "\\", not the last.

See How will my regular expression match? for more information.

Hugo