Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: is this a regexp question ?

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


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 05: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
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-25 09:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found