jayd11 has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks, need your inputs on the below scenario I am trying to convert sql like operation on perl regular expression I have to compare two variable strings , one string is coming as sql like operator (%) 3 scenarios -
I am not able to achieve this in perl , can someone help on this codefoo% ( similar in perl ^foo+ ) %foo% ( similar in perl foo +) %f%o% ( no idea on perl)
Thanks,$find1='%'; if ($field2_b ne "") { s/[^$find1]?^/\^/,s/[$find1]?$/+/ for $field2_b + }; if ($field1 =~ /$field2_b/i) { print "fields have pattern matching \n" +;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Need to append and replace for % sign in a variable string
by Corion (Patriarch) on May 24, 2015 at 07:25 UTC | |
|
Re: Need to append and replace for % sign in a variable string
by AnomalousMonk (Archbishop) on May 24, 2015 at 07:42 UTC | |
|
Re: Need to append and replace for % sign in a variable string ( Regexp::Wildcards->new( type => 'sql')
by Anonymous Monk on May 24, 2015 at 07:28 UTC | |
by hdb (Monsignor) on May 24, 2015 at 07:48 UTC |