Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
There's more than one way to do things
 
PerlMonks  

Re: is this a regexp question ?

by jorg (Friar)
on Jun 04, 2001 at 00:42 UTC ( [id://85387]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to is this a regexp question ?

I'm not sure whether you can eval a function in a regex. If I understand your question correctly, you can just do
sub search_equivalent{ #do stuff here and return your equivalent pattern return $equivalent; } my $equiv = search_equivalent(); if ($thisstring =~ m/$equiv/){ .... }
There is no real need to put a function call in the regex.

Jorg

"Do or do not, there is no try" -- Yoda

Replies are listed 'Best First'.
(ar0n) Re (2): is this a regexp question ?
by ar0n (Priest) on Jun 04, 2001 at 01:14 UTC
    Even though this is probably not what he meant, you can call a function from within a code-block within a regex:
    $foo =~ /(?{match_foo()})/;

    ar0n ]

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://85387]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.