Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: callback for regex engine

by zork42 (Monk)
on Jun 21, 2013 at 09:26 UTC ( #1040119=note: print w/ replies, xml ) Need Help??


in reply to callback for regex engine

I was wondering if there is a capability in Perl to register a call back to the regex engine and call that registered function each time a particular match is made.
This might be of interest:
s///e and s///ee allow you to execute arbitrary any code (presumably including function calls) for each match
See s/PATTERN/REPLACEMENT/msixpodualgcer in Regexp Quote Like Operators (you have to go down a few pages):
e  Evaluate the right side as an expression.
ee Evaluate the right side as a string then eval the result.


UPDATE: s/arbitrary/any/
(In response to ikegami's post below. Unless I'm misunderstanding ikegami's misunderstanding :) )


Comment on Re: callback for regex engine
Re^2: callback for regex engine
by ikegami (Pope) on Jun 23, 2013 at 00:55 UTC
    [I was confused by the term "arbitrary code", which is normally used to refer to how s///ee can execute code found in data. Ignore this post.]

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1040119]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (13)
As of 2014-09-19 12:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (137 votes), past polls