in reply to Rematching within a regular expression

This may or may not be good in your case...

#!/usr/bin/perl -l $x = "dog 789 cat dog dog bird cat wonder dog frog cat"; @finds = ($x =~ /((?:dog)(?:.*?)(?:cat))/g); $y = reverse $x; @finds2 = ($y =~ /((?:tac)(?:.*?)(?:god))/g); print for @finds; print "-----"; print scalar reverse for reverse @finds2;

Ouptuts:

dog 789 cat dog dog bird cat dog frog cat ----- dog 789 cat dog bird cat dog frog cat

It's a nice technique to know, anyway. (The credit goes to japhy for it.)

-sauoq
"My two cents aren't worth a dime.";