Samuel D.Murphy
Samuel D.Murphy

Reputation: 191

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"/>...

How can I get all image names as QStringList using QRegExp from html?

result = emo12.gif, emo8.gif, emo9.gif

I can not make regular expression.

Upvotes: 0

Views: 37

Answers (1)

Scott Weaver
Scott Weaver

Reputation: 7361

In this case you could parse them with this pattern: (match is in the first capture group)

(\w+\.\w+)"

demo: https://regex101.com/r/gAzPJo/1/

Upvotes: 1

Related Questions