Sounds like you got yourself stuck in something that I believe psychologistics call "functional fixidity" you were preconditioned (probably by reading too many nodes by abigail-ii ;-) that you forgot that tree traversal is a simple thing.
Anyway I offer this little perspective to maybe help you avoid such things in the future. You can metally model most perl regexes as representing a tree, a tree whose job is to see if there is a path in a given string that can traverse the tree to a legal "accepting" terminal node. So in a sense using a regex to find a path toa given node is almost the opposite of what you really want.
BTW, this is only really true of an NFA based regex engine. A DFA based regex engine would traverse all the branches of the equivelent NFA engine simultaneously, arriving at the same point, but without ever backtracking.
First they ignore you, then they laugh at you, then they fight you, then you win.
-- Gandhi
In reply to Re^3: Logic programming without using the RE engine as a crutch
by demerphq
in thread Logic programming without using the RE engine as a crutch
by diotalevi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |