main logo
Subject: Re: [V4MD] regex & escape
Author: Ruslan Zasukhin
Posted: 2003/12/17 08:38:00
 
View Entire Thread
New Search


on 12/17/03 3:13 PM, Martin Kloss at martin.kloss (AT) gmx .DO.T 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@paradigmasoft.com
web: http://www.paradigmasoft.com

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

_______________________________________________
Valentina mailing list
Valentina (AT) lists .DO.T macserve.net
http://lists.macserve.net/mailman/listinfo/valentina




 
©2003 Ruslan Zasukhin
<-- Prior Message New Search Next Message -->