#!usr/bin/perl use warnings; $_ = "start b2 end start b2 b2 end start b2 end"; @Matches = / # list context to catch all (?<= \b start \b )# 'start' must precede ( .*? ) # catch fewest possible anythings (?= \b end \b )# 'end' must follow /gx # global and expressive and print join("\n", @Matches); __DATA__ b2 b2 b2 b2 #### @Matches = / \b start \b ( .*? ) \b end \b /gx