in reply to Rematching within a regular expression

Use a negative look-ahead:
$_ = "dog 789 cat dog dog bird cat wonder dog frog cat"; my @finds = /(dog(?:(?!dog).)*?cat)/g; say Dumper \@finds;
Outputs:
[ "dog 789 cat", "dog bird cat", "dog frog cat" ]