> Can anyone explain [Eager / Greedy], please?

Perl's regex engine is both Eager (Leftmost start)
and Greedy (Rightmost end).

The Greedy aspect is subservient to the Eager one.

The ? stops it being Greedy but not Eager.

To get the rightmost match, you could try adding
a .* at the start of the regex to greedily match from
the beginning.

See the Cookbook for more on this.

Reply via email to