in reply to Pattern matching: Lazy vs. greedy

problem is that you want to anchor on "dog" not "the".

You could reverse the string , regex and match.

$string =~ /(god .*? eht)/i;

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)

PS: Je suis Charlie!

Replies are listed 'Best First'.
Re^2: Pattern matching: Lazy vs. greedy
by false_friend (Novice) on Mar 30, 2015 at 09:15 UTC
    Thank you also, Rolf. I’ll be excited to see which way is the fastest.