PATCH: kdelibs/kdecore/kstringhandler.cpp tagURLs() method

Stephan Hermann sh at kde-coder.de
Fri Jul 12 09:09:52 BST 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

On Thursday 11 July 2002 21:34, Marc Mutz wrote:
> On Thursday 11 July 2002 13:11, Stephan Hermann wrote:
> <snip>
>
> > Well, I changed the regexp in this way:
>
> (cleaned up C-string quoting)
> (?:www\.|ftp\.|\w+\://)[\d\w\.]+[:\d]{0,}[/]{0,1}[~/\.-?&=#:_\d\w]{0,}
>                                      ^1  ^2 ^3                    ^4
> 1: wouldn't this be "*"

No.
	"*" == matching 0 or more times
	+   == matching 1 or more times

We want to check URLs not shortcuts like gg: or some malformed urls out of the 
kurl testsuite ;)

so + is the right choice...but I got a mistake in here and fixed it (good 
point with testsuites, thx harri :)) a "/" was missing.


> 2: a class with a single char?

you mean \d ? you're right..this is one of the mistakes


> 3: wouldn't this be "?"

sure

> 4: see (1)
nope

> > And at least, the replacement in hrefProtocol I changed, too.
> > Not in this way, you described in your last mail, but I used sprintf
> > and QString::latin1()
>
> <snip>
>
> How exactly? Since QString::sprintf() assumes %s parameters to be in
> UTF-8, not latin1.

Forget about it ;) i  used now the concatenation solution.

I put some tests into kdelibs/kdecore/tests/kstringhandlertest.cpp (see the 
attached patch)

BTW: I'll fixed a kstringhandler testsuite bug, too.
        the test for revert was wrong. the "has to be" string missed a space 
char at the beginning (see patch)


Regards,
\sh

- -- 
St. Hermann, Troisdorf
One solution for a simple problem: A7 B4 C2 D5 E8 F1 G3 H6
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9Lo7SV8AnusWiV6wRAihZAKDRJ9bYuMd2Mu7BaowkW1sLmhU+lQCg0swy
j31ZSLRNWyp3NDRcifeqgMM=
=5RjR
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kstringhandler.cpp.patch
Type: text/x-diff
Size: 1635 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20020712/9cb30823/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kstringhandlertest.cpp.patch
Type: text/x-diff
Size: 1603 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20020712/9cb30823/attachment-0001.patch>


More information about the kde-core-devel mailing list