Reputation: 39881
I have written
QRegExp rx("<img src=\"\\S+\"\\s+width=\"(\\d+)\"\\s+height\"(\\d+)\"\\s+/>");
RegExp in order to match
<img src="file://c/Users/Narek/Desktop/WClub.jpg" width="95" height="113.04" />
kind of substring in a string, in order to extract the width and height. But this does not match. Please tel me what I have done wrong.
Upvotes: 0
Views: 828
Reputation: 11797
The last \d
doesn't take account of the dot inside the number, and you are missing '=' after 'height'.
Upvotes: 2
Reputation: 17956
\d
does not match the period in your height.
A regular expression that would work would be something like:
<img src=\"[^"]*\"\s+width=\"(\d+(?:\.\d+)?)\"\s+height=\"(\d+(?:\.\d+)?)\"\s+/>
Also, the obligatory comment that it is a bad idea to parse HTML using Regex.
Upvotes: 4