RegEx help

Charles Yeomans yeomans at desuetude.com
Wed Jul 2 10:56:32 CDT 2003


On Wednesday, July 2, 2003, at 07:38 AM, Wonder Fef wrote:

>
> First, thanks for your answer.
>
>>   "M.G.M" -- you mean that user type DOTS ?
>>  and you want find MGM ?
>
> Yes. You know, the Metro Goldwin Mayer may be also called "MGM" or 
> "M.G.M"
>
>> Then you need first of all self correct user's input to "MGM"
> Alas, users are unpredictable and not that flexible !
> Some will input "MGM" and others "M.G.M" or even "M.G.M."
>
>> To do this you need query as
>>   WHERE fld LIKE 'M.*G.*M'
>> Here '.*' say that between M and G can be zero or any number of any 
>> chars.
>
> Good idea, but this will also find records like "magma", "my genius 
> mind",
> etc.
> I'd just like to escape/ignore the dot character...
> Is that possible?
>
>

Sure; that's what the "?" quantifier is for.  "M\.?G\.?M.?" will match 
"MGM" or "M.G.M", but not "M G M" or "magma".  The backslash should 
tell the RegEx engine to treat the "." as a the period character and 
not as the any-character metacharacter.

Charles Yeomans



More information about the Valentina mailing list