Easy question i hope

hi i need to strip out some boolean operators from search input
this is what i need to remove
params[:search_input].gsub!(/AND|OR|&&|||/,'')
it all works except for || which i suppose is because it is interpreted
as meaning or nothing or nothing. so how can i remove the || from the
input?
regards
caspar

···

--
Posted via http://www.ruby-forum.com/.

\|\| (escape with \)

···

On 8/30/06, Caspar Bl <waspfactory@gmail.com> wrote:

hi i need to strip out some boolean operators from search input
this is what i need to remove
params[:search_input].gsub!(/AND|OR|&&|||/,'')
it all works except for || which i suppose is because it is interpreted
as meaning or nothing or nothing. so how can i remove the || from the
input?
regards
caspar

params[:search_input].gsub!(/AND|OR|&&|\|\|/, '')

Blessings,
TwP

···

On 8/30/06, Caspar Bl <waspfactory@gmail.com> wrote:

hi i need to strip out some boolean operators from search input
this is what i need to remove
params[:search_input].gsub!(/AND|OR|&&|||/,'')
it all works except for || which i suppose is because it is interpreted
as meaning or nothing or nothing. so how can i remove the || from the
input?
regards
caspar

Caspar Bl wrote:

hi i need to strip out some boolean operators from search input
this is what i need to remove
params[:search_input].gsub!(/AND|OR|&&|||/,'')
it all works except for || which i suppose is because it is interpreted
as meaning or nothing or nothing. so how can i remove the || from the
input?

Some characters have special meaning to the regular expression engine. To
force them to be interpreted literally (as normal characters), escape them,
like this:

params[:search_input].gsub!(/AND|OR|&&|\|\|/,'')

···

--
Paul Lutus
http://www.arachnoid.com