PATCH: BR# 71590: Workaround for QRegExp bug in wildcard matching (globbing) mode.
Adriaan de Groot
adridg at sci.kun.nl
Mon Jan 5 09:51:55 GMT 2004
On Mon, 5 Jan 2004, Waldo Bastian wrote:
> On Mon January 05 2004 01:57, Dawit A. wrote:
> > QRegExp rx ("*.kde", true, true)
> > int res = rx.search( "www.kde.org"); // Should return -1. DOES NOT.
> > bool res2 = rx.exactMatch("www.kde.org"); // Works correctly.
> I fail to see the Qt problem actually. Either I misunderstand or you have just
> discovered that search and exactMatch are not the same. But that should
> hardly come as a surprise, no?
The docs (from Qt 3.1, admittedly) say:
* This matches zero or more of any characters. It is the same
as .* in full regexps.
If you look at the regexp in that way, then it's not strange that *.kde
matches in www.kde.org. Shell (as in /bin/sh) globbing inserts an implicit
$, so that *.kde means strings ending in .kde and nothing else. This makes
wildcard matching less useful than it might be, except in the exactMatch()
case, which is documented
search("^R$") since exactMatch() effectively encloses the regexp
in the start of string and end of string anchors,
So Waldo is right.
Adriaan de Groot adridg at cs.kun.nl Kamer A6020 024-3652272
GPG Key Fingerprint 934E 31AA 80A7 723F 54F9 50ED 76AC EE01 FEA2 A3FE
More information about the kde-core-devel