[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

easy question i hope

Caspar Bl

8/30/2006 4:20:00 PM

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-....

5 Answers

Jano Svitok

8/30/2006 4:36:00 PM

0

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
\|\| (escape with \)

Paul Lutus

8/30/2006 4:40:00 PM

0

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.ara...

Tim Pease

8/30/2006 4:40:00 PM

0

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

Eddie Haskell

8/20/2012 2:52:00 PM

0


"Bill Smith" <quandary@newsguy.com> wrote in message
news:q71338t4convht68s9abljkt5dbdmqq48a@4ax.com...
> On Sun, 19 Aug 2012 23:59:47 GMT, wblevins@fbi.gov (Angle of
> Insolation) wrote:
>
>>"We can have democracy in this country or we can have great
>>wealth concentrated in the hands of a few, but we can't have
>>both." -Louis Brandeis
>>
>>Guess what we have today in the Amerikkkas.
>>
>>---
>>"Fred" is my Christian name.
>
>
> If his vision has come true, why did we elect a Democratic President,
> and why did we have a Democratically controlled Congress for two
> years?

Because we live in a country controlled by a Goebbels MSM.

-Eddie Haskell


Eddie Haskell

8/20/2012 2:54:00 PM

0


"Angle of Insolation" <wblevins@fbi.gov> wrote in message
news:HsednTeGY_MNLqzNnZ2dnUVZ_v2dnZ2d@posted.sonicnet...
> Bill Smith <quandary@newsguy.com> wrote:
>>On Sun, 19 Aug 2012 23:59:47 GMT, wblevins@fbi.gov (Angle of Insolation)
>>wrote:
>>>"We can have democracy in this country or we can have great
>>>wealth concentrated in the hands of a few, but we can't have
>>>both." -Louis Brandeis
>>>Guess what we have today in the Amerikkkas.
>>If his vision has come true, why did we elect a Democratic President,
>>and why did we have a Democratically controlled Congress for two
>>years?
>
> You may have noticed that the Democrats are *zero* different from
> the Republicans.

What I noticed is that you are full of shit.

-Eddie Haskell