in reply to How do you make a regex non greedy
Not so simple. You have also to anchor the left hand end:
s/^.*?TEST/TEST/ [download]
Update: Argh - one day I'll stop getting bitten by that! Anonymous Monk is quite right. No backtracking is required to get a match so .*? matches everything from the start or the string up to TEST - no anchor needed.
$_ = '1 TEST 2 TEST 3 TEST'; s/.*?TEST/TEST/; print; __END__ TEST 2 TEST 3 TEST [download]