-2

I have a number of lists in a string:

<select id="first">
  <option value="0">Val11</option>
  <option value="0">Val12</option>
  <option value="0">Val13</option>
</select>
<select id="second">
  <option value="0">Val21</option>
  <option value="0">Val22</option>
  <option value="0">Val23</option>
</select>
<select id="third">
  <option value="0">Val31</option>
  <option value="0">Val32</option>
  <option value="0">Val33</option>
</select>

I can parse values in general, but how can I parse the values of certain list, say, of list with id="second". I want to get only

Val21
Val22
Val23
Nawaz Ghori
  • 591
  • 6
  • 20
amplifier
  • 1,793
  • 1
  • 21
  • 55
  • @WiktorStribiżew I didn't mentioned, I use it in QRegularExpression and QRegularExpressionMatchIterator – amplifier Nov 02 '17 at 12:17
  • Sorry, but isn't there a better way to parse HTML in Qt? See [this post](https://stackoverflow.com/questions/18676800/how-to-parse-html-with-c-qt). – Wiktor Stribiżew Nov 02 '17 at 12:37

1 Answers1

0

I hope this might help:

<option.+?>(.+?)</option>

It will match anything inside the "option" tags. The stuff in the parenthesis is the data you are looking for, you can access it with "$1", or "\1".

Let me know how it goes.

Adriano
  • 3,788
  • 5
  • 32
  • 53