mmm286
11th November 2009, 17:14
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!
Lykurg
11th November 2009, 17:43
Start with the documentation of QRegExp
QRegExp rx("(\\d+)");
QString str = "Offsets: 12 14 99 231 7";
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"]
And 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"!
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.