QRegExp 用法:如何从 html 字符串中获取图像名称?
QRegExp Usage: How Can I get image names from html string?
html = ... <span>emoticon12</span><img src="qrc:\res\emoticon\emo12.gif" width="20" height="20"/><span>emoticon8</span><div>...</div><img src="qrc:\res\emoticon\emo8.gif" width="20" height="20"/>...<img src="qrc:\res\emoticon\emo9.gif" width="20" height="20"/>...
如何使用 QRegExp 从 html 获取所有图像名称作为 QStringList?
结果 = emo12.gif、emo8.gif、emo9.gif
我不会做正则表达式。
在这种情况下,您可以使用以下模式解析它们:(匹配在第一个捕获组中)
(\w+\.\w+)"
html = ... <span>emoticon12</span><img src="qrc:\res\emoticon\emo12.gif" width="20" height="20"/><span>emoticon8</span><div>...</div><img src="qrc:\res\emoticon\emo8.gif" width="20" height="20"/>...<img src="qrc:\res\emoticon\emo9.gif" width="20" height="20"/>...
如何使用 QRegExp 从 html 获取所有图像名称作为 QStringList?
结果 = emo12.gif、emo8.gif、emo9.gif
我不会做正则表达式。
在这种情况下,您可以使用以下模式解析它们:(匹配在第一个捕获组中)
(\w+\.\w+)"