in reply to Rematching within a regular expression
$_ = "dog 789 cat dog dog bird cat wonder dog frog cat"; my @finds = /(dog(?:(?!dog).)*?cat)/g; say Dumper \@finds; [download]
[ "dog 789 cat", "dog bird cat", "dog frog cat" ] [download]