16,199
社区成员
发帖
与我相关
我的任务
分享
QString pattern = "<a href=\"http://www.****.com/showpage.asp?id=(.*?)\">(.*?)</a>";
QRegExp rx(pattern);
rx.setCaseSensitivity(Qt::CaseInsensitive);
rx.setMinimal(true);
QString str = "<a href=\"http://www..****.com/showpage.asp?id=17\">红内线直播</a>";
int pos = rx.indexIn(str);
while ((pos = rx.indexIn(str, pos)) != -1) {
QMessageBox::information(this, "匹配了", rx.cap(1));
pos += rx.matchedLength();//继续寻找下一个匹配
}
QString pattern = "<a href=\"http://www.****.com/showpage.asp?id=(.*?)\">(.*?)</a>";
QRegExp rx(pattern);
rx.setCaseSensitivity(Qt::CaseInsensitive);
rx.setMinimal(true);
QString str = "<a href=\"http://www.****.com/showpage.asp?id=17\">红内线直播</a>";
int pos = rx.indexIn(str);
while ((pos = rx.indexIn(str, pos)) != -1) {
QMessageBox::information(this, "匹配了", rx.cap(1));
pos += rx.matchedLength();//继续寻找下一个匹配
}