[V4MD] regex & escape

Ruslan Zasukhin sunshine at public.kherson.ua
Wed Dec 17 15:39:38 CST 2003


on 12/17/03 3:13 PM, Martin Kloss at martin.kloss at gmx.de wrote:

> Hi,
> 
> I need to do a regex search, but I have to also escape the string so it
> will not
> blow the SQL statement to pieces. The problem is that I can't seem to figure
> out how to use the "?" or "*" characters in the regex search, because they
> always get escaped.



> Example input:    m*ller's
                    ^^^^^^

> Generate query:
> 
> ...LIKE '(?i)" & ValentinaEscapeString(myInputString, TRUE) & "'"
> 
> which results in:
> 
> LIKE '(?i)m\*ller\'s'
> 
> That's ok, since the last parameter tells the function to escape for regex,
> like stated in the docs. But how can I use the '"*" as a regex operator?

> Do I need to set the parameter to FALSE and only quote quotes?
> Then the documentation does not make any sense. Or what is it that
> I don't get?

Hmm, I also seating ant and think...why we have escape them?   :^)

Okay, try FALSE and let me know if REGEX then works fine.

Aha, I have remember!


Assume your string will have () as chars, but not REGEX chars.
Let use want to find pattern

        m.ller's (data)

Then you need produce

    LIKE '(?i)m.ller\'s \(data\)'


To do this you need use escape string on user's pattern.


--------------
BTW, you say about * and ?
In REGEX is used not * but .



-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list