Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Being Forced to Fork with Nested Regular Expressions

by halley (Prior)
on Jan 02, 2004 at 18:12 UTC ( #318386=note: print w/replies, xml ) Need Help??


in reply to Being Forced to Fork with Nested Regular Expressions

I also wanted to abuse the regex system with twelve-level-deep s///e recursion to implement my Pentominos Solving Quine, but instead found that perl would crash horribly if it tried to recurse there.
for $pattern (@patterns) { while ($data =~ m/(?=$pattern)/g) { do_recurse($data, pos($data), $pattern); # $data is the source # pos($data) is the found place in the souce ++pos($data); } }
The alternative method uses pos() as an lvalue and m/(?=)/g as in the loop above, to allow me to iterate through matches yet not recurse via any regex code-evaluating trick. I do recurse, but not by getting the regex to do the call.

--
[ e d @ h a l l e y . c c ]

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://318386]
help
Chatterbox?
[Discipulus]: ah so there are also coccurence of 'good' weather? ;=)

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2018-01-17 08:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (196 votes). Check out past polls.

    Notices?