Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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 chanting in the Monastery: (11)
As of 2014-09-16 16:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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











    Results (35 votes), past polls