Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

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; }


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

Hope this helps!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://991671]
[holli]: i am designing an interface. check this out, can you tell immediatly tell me what the code does?
[holli]: scratch one "tell". you decide which ;)
[danaj]: :) Thanks, I should visit more often.
[holli]: you should visit the link i posted and answer my question
[stonecolddevin]: good afternoon all
[holli]: if you know what's good for you
[holli]: hahaha
[stonecolddevin]: hey holli, long time no chat
[holli]: g'day sir

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (9)
As of 2017-09-26 21:18 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (297 votes). Check out past polls.