use v5.14; use re "/sixm"; $_ = "This part is past all of this paaRTy of the string. Paaaaarty on!"; my @matches = (); sub show_matches { printf "Got %d matches:\n", scalar @matches; my $i = 1; for (@matches) { printf " %2d\t$_\n", $i++, $_; } } @matches = / pa .* rt /g; show_matches(); @matches = / pa .*? rt /g; show_matches(); @matches = / (?= (pa .* rt) ) /g; show_matches(); @matches = (); () = / (pa .* rt) (?{push @matches, $^N}) (*FAIL) /g; show_matches();