c:\@Work\Perl>perl -wMstrict -le "my $s = qq{xxx \@B grab \n this \@E yy zzzz \@B and \n this \n too \@E qq}; print qq{[[$s]]}; ;; my @captures = $s =~ m{ \@B .*? \@E }xmsg; print qq{<<$_>>} for @captures; " [[xxx @B grab this @E yy zzzz @B and this too @E qq]] <<@B grab this @E>> <<@B and this too @E>> #### c:\@Work\Perl>perl -wMstrict -le "my $s = qq{xxx \@B grab \n this \@E yy zzzz}; print qq{[[$s]]}; ;; my @captures = $s =~ m{ \@B (.*?) \@E }xmsg; print qq{<<$_>>} for @captures; " [[xxx @B grab this @E yy zzzz]] << grab this >>