Sunday, 7 May 2017

Obtaining specific part of string from field in QGIS attribute table?


I'm having a bit of trouble here with this situation.


enter image description here


I want "NumeroCamp" only to have the numbers are showing in "Text".


Is there any function in field calculator that could help me with that?




Answer



You can use the following expression in the field calculator (tested on QGIS 2.18):


regexp_substr( "Text", ';(\\d*)\}' )


This will return all digits (as text) between the ; and } characters.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...