REGEX \ search

Ruslan Zasukhin sunshine at public.kherson.ua
Wed Jul 20 15:17:37 CDT 2005


On 7/20/05 3:02 PM, "jda" <jda at his.com> wrote:

>>> Really? What's wrong with this query?
>>> 
>>>  select id,hit from thereferences where (allFields REGEX '(?i)\\')
>>> order by id
>> 
>> Please read in mantis
>> 
> 
> I see, Ruslan. But that's nuts (crazy). You should only need ONE \
> character to escape any other. This makes \ a special exception.

> I now have to do a REPLACEALL('\', '\\') for each search string BEFORE
> escaping. This is, excuse me, ridiculous.

NO !!!!!!!!!!!!!!

You should not REPLACE it !!!

You should use our Valentina.EscapeString()
 
> '\\' should work.
> 
> But I will do it if I have to.

Do it in right way. Again

----------------------------------------
Starting from 2.0.5 manual query must look as
 
    select id,hit from thereferences where allFields LIKE '%\\\\%'
or 
    select id,hit from thereferences where allFields REGEX '(?i)\\\\'
 
In your application user must type:
    select id,hit from thereferences where allFields LIKE '%\\%'
    select id,hit from thereferences where allFields REGEX '(?i)\\'

and after you use Valentina.EscapeString() you will get required
query with 4 symbols back slash.
----------------------------------------

Where you see problems?

You user in your Application must enter string to do REGEX search.,
User know that he is doing REGEX search, right ?

If I want in CodeWarrior do search on strings that have \
I type in the search dialog of CodeWarrior

                   \\

The same I will expect todo in YOUR application.
THE SAME will do any your user who know REGEX.

Then you get from Edit field string "\\"
And you do next:

    q = "select id,hit from thereferences where allFields REGEX '(?i)"
    
    q = q + Valentina.EscapeString( regexEditField.text )

    q = q + "'"

So you get the correct query:

    select id,hit from thereferences where allFields REGEX '(?i)\\\\'



-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]




More information about the Valentina mailing list