16,211
社区成员
发帖
与我相关
我的任务
分享
QRegExp urlReg("(a href=).+?(</a></li>)");//我想匹配a href=开头、</a></li>结尾的字符串
if(!urlReg.isValid()){
qDebug()<<tr("正则非法:\n")<<qPrintable(urlReg.errorString())<<endl;
return urlMap;
}
int pos = 0;
QString tempStr;
while((pos = urlReg.indexIn(webContent,pos) != - 1)){
tempStr = urlReg.cap(1);
pos += urlReg.matchedLength();
qDebug()<<"\n======================================\n"<<tempStr<<"\n======================================\n"<<endl;
}
return urlMap;