RegEx help

Wonder Fef wonderfef at noos.fr
Thu Jul 3 09:15:08 CDT 2003


> 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.

Yes, thank you, that works!

But I first have to remove all dots from the user's search string, and then
insert "\.?" between all characters from this string.

If the user is searching for "M.G.M", I remove all dots and I get "MGM"
instead, and then I insert "\.?" between all characters and add one at the
end in order to obtain "M\.?G\.?M\.?"
Now Valentina can find "MGM", "M.G.M" or even "M.G.M."

Thanks to all for your precious help
Eric



More information about the Valentina mailing list