qgis – Regex substr – Extracting number after specific text sequence
Couldn’t find any solution to a specific sequence.
Context: italian cadaster, where plot number is embedded in a table coded in kml, in the “description” field. I want to extract the plot number.
Part of the code is:
...<tr>
<td>SVILUPPO</td>
<td>25</td>
</tr>
<tr bgcolor="#D4E4F3">
<td>NUMERO</td>
<td>156</td>
</tr>
<tr>
<td>LIVELLO</td>..."
In this example, I want to get: 156. There are other categories (commune, cadastral sheet, etc., with other numbers. I need to identify the right number quoting “NUMERO”.
Tried:
regexp_substr( "description" , 'NUMERO</td> \n\n <td>(\\d+)<' )
or
regexp_substr( "description" , 'NUMERO \\D+ (\\d+) <' )
With:
‘NUMERO as the start of the sequence,
\D+ as any non decimal character,
(\d+) to extract subchain with any number
< to close the sequence.
Both formulas are valid, but I get ‘NULL’ in return. I can’t see why.
Any help much welcome.
Read more here: Source link
