# Easy question i hope

**URL:** <https://www.ruby-forum.com/t/easy-question-i-hope/66971>\
**Category:** Ruby\
**Created:** [August 30, 2006, 6:19pm UTC](https://www.ruby-forum.com/t/easy-question-i-hope/66971 "2006-08-30T18:19:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f04885/32.png) [@ghost](https://www.ruby-forum.com/u/ghost)\
**Post date:** [August 30, 2006, 6:19pm UTC](https://www.ruby-forum.com/t/easy-question-i-hope/66971/1 "2006-08-30T18:19:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f04885/32.png) [@ghost](https://www.ruby-forum.com/u/ghost)\
**Post date:** [August 30, 2006, 6:37pm UTC](https://www.ruby-forum.com/t/easy-question-i-hope/66971/2 "2006-08-30T18:37:39Z")

</div>

On 8/30/06, Caspar Bl [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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 )

---

<div class="post-metadata">

**Author:** ![ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f04885/32.png) [@ghost](https://www.ruby-forum.com/u/ghost)\
**Post date:** [August 30, 2006, 6:41pm UTC](https://www.ruby-forum.com/t/easy-question-i-hope/66971/3 "2006-08-30T18:41:39Z")

</div>

On 8/30/06, Caspar Bl [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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

---

<div class="post-metadata">

**Author:** ![ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f04885/32.png) [@ghost](https://www.ruby-forum.com/u/ghost)\
**Post date:** [August 30, 2006, 6:41pm UTC](https://www.ruby-forum.com/t/easy-question-i-hope/66971/4 "2006-08-30T18:41:40Z")

</div>

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|&&|||/,’’)
