this is a sentence
赞
踩
参考:
https://www.jb51.net/article/48765.htm?pc
https://blog.csdn.net/struggle6688/article/details/65444121?utm_medium=distribute.pc_relevant_t0.none-task-blog-OPENSEARCH-1.add_param_isCf&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-OPENSEARCH-1.add_param_isCf
QString str = "sfsdfsdvsd<fsdfsd>this is a sentence</sdfsdf>";
QRegExp exp("(?:>)(.*)(?:<)"); //里面那两个 > < 可以替换成其他,但是要注意转义字符
//QRegExp exp("(?:\\[)(.*)(?:\\])");
qDebug() << "index:" << exp.indexIn(str);
if(str.indexOf(exp) >= 0)
{
qDebug() << "something cap:" << exp.matchedLength();
qDebug() << exp.cap(0);
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。