Hi,
I have the html source of a URL in a QString. How could I get all the links with QRegExp?
Many thanks and sorry for my english!
Hi,
I have the html source of a URL in a QString. How could I get all the links with QRegExp?
Many thanks and sorry for my english!
Start with the documentation of QRegExpAnd then simply write a expression which fits your needs. It isn't so complicated... And if you don't know use google with "regular expressions link href"!Qt Code:
QStringList list; int pos = 0; while ((pos = rx.indexIn(str, pos)) != -1) { list << rx.cap(1); pos += rx.matchedLength(); } // list: ["12", "14", "99", "231", "7"]To copy to clipboard, switch view to plain text mode
Bookmarks