0

I would like to parse with a QRegular Expression this text.

<td>+7/+2</td><td>+3</td><td>+7</td><td style="white-space: normal;">Jack-of-all-trades, Versatile performance</td>

What I currently did is that:

QString regex = "(<td>)(.*?)(</td>)|(<td style=\"white-space: normal;\">)(.*?)(</td>)|(<td style=\"white-space: normal;word-wrap: break-word;\">)(.*?)(</wbr></td>)";
QRegularExpression re(regex);

and the output is:

match.captured(2);  ----->  +7/+2
match.captured(2);  ----->  +3
match.captured(5);  ----->  Jack-of-all-trades, Versatile performance

I would like to parse, in the first expression, just the numbers without the char "+".

I tried expression like this:

QString regex = "(<td>)([^+].*?)(</td>)|(<td style=\"white-space: normal;\">)(.*?)(</td>)|(<td style=\"white-space: normal;word-wrap: break-word;\">)(.*?)(</wbr></td>)";

...and it worked but I was not able anymore to see the output on match.captured(5). why? :)

Hawke
  • 32
  • 5

0 Answers0