Quantcast
Channel: Jobs
Viewing all articles
Browse latest Browse all 18427

[SOLVED] How to use "(" character in QRegExp to find matches in string?

$
0
0
I have some HTML code and I want to get links from it. HTML code I have is in QString format and I want to split it by matches as href=” and url(. If I do something like: QStringList lst; QRegExp regexp("\\href=\""); // \" works ok lst = htmlCode.split(regexp); everything works and it split my html string (later I will cut the rest and have just link without text after second “ character in href=”“) but if I do QStringList lst; QRegExp regexp("\\url\("); // \( fails lst = htmlCode.split(regexp); string doesn’t split for some reason, I see problem is with \( but I don’t know why. I tried do it as regexp(”\\url(”); and by ascii as regexp(”\\url\50”) (wondering why it takes numbers as octal) neither worked, it just returns original string. I am still newbie in Qt so please help me or if there is better way to extract links from html code than I want to use I’ll be happy if you guys tell me.

Viewing all articles
Browse latest Browse all 18427

Trending Articles