c:\@Work\Perl\monks>perl -wMstrict -le "my $s = 'xxx xyzzyfooAbar yyy xyzzyzotBbar zzz'; ;; my $match; ;; print qq{A: .*: '$match'} if ($match) = $s =~ m{ (xyzzy .* bar) }xms; print qq{B: .* A: '$match'} if ($match) = $s =~ m{ (xyzzy .* A bar) }xms; print qq{C: .*?: '$match'} if ($match) = $s =~ m{ (xyzzy .*? bar) }xms; " A: .*: 'xyzzyfooAbar yyy xyzzyzotBbar' B: .* A: 'xyzzyfooAbar' C: .*?: 'xyzzyfooAbar'