Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
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 studying the Monastery: (5)
As of 2015-07-03 00:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (47 votes), past polls