Woops... corrected code below:

> def escape_string(str)
>       return Regexp.escape(str).gsub(/([:~!<>="])/,'\\\\\1')
> end


On Jan 16, 2008, at 3:51 PM, Benjamin Arai wrote:

> Hello,
>
> I am going to answer my own questions...
>
> You can do something like:
>
> def escape_string(str)
>       str = Regexp.escape(item[:word]).gsub(/([:~!<>="])/,'\\\\\1')
> end
>
> At one time there was a function called clean_string in QueryParser
> but it appears to be gone.
>
> Benjamin
>
> On Jan 16, 2008, at 1:03 PM, Benjamin Arai wrote:
>
>> Hello,
>>
>> I am trying to escape words for searching i.e., "hello". The key here
>> is that the two L's on "hello" are actually vertical bars.  Is there
>> a special function in Ferret or anywhere for that matter that will do
>> the escaping of the Ferret special characters?
>>
>> Thanks in advance,
>>
>> Benjamin
>> _______________________________________________
>> Ferret-talk mailing list
>> [email protected]
>> http://rubyforge.org/mailman/listinfo/ferret-talk
>>
>
> _______________________________________________
> Ferret-talk mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/ferret-talk
>

_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to