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

Re: Regular expression to match query

by Kenosis (Priest)
on Sep 04, 2012 at 18:13 UTC ( #991671=note: print w/ replies, xml ) Need Help??


in reply to Regular expression to match query

Perhaps the following will work for you:

use Modern::Perl; my @strs = ( '(View like all data) AND (Path not like /usr/bin)', '(View like all data AND Path not like /usr/bin)' ); for (@strs) { s/all\s+([^)]+)(\)?\s+AND.+like\s+)([^)]+)/all %$1%$2%$3%/; say; }

Output:

(View like all %data%) AND (Path not like %/usr/bin%) (View like all %data% AND Path not like %/usr/bin%)

Hope this helps!


Comment on Re: Regular expression to match query
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (9)
As of 2014-04-17 01:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (437 votes), past polls