I'm trying to plot a series of contours in QGIS based on dxf data exported from some specialised mining software. The attirbute output is pretty ugly and merges a few fields together.
DXFName=C5ドル DXFGroup= DXFFeature= DXFValue=50.0 DXFDescription=Major contour at level 50.000 DXFPrimitive= DXFLine=0 DXFPattern=0
I need to extract just the 'DXFValue=' value to allow categorised symbology, and labelling of the contours.
I've played around with rule based symbology using the 'regexp_substr' function, but I don't have the regex knowledge to produce what I need.
Anyone able to assist?
Thanks!
1 Answer 1
You can use the following expression to extract the values you want:
regexp_replace("test", '.*DXFValue=([0-9\.\-]{1,}).*', '\1円')
This function replaces the entire string with the first matched group (the '\1円'
), which is the string contained in the brackets '([0-9\.\-]{1,})'
, coming after 'DXFValue='
.
Remember to set the output field type to 'Decimal number (real)'.
field calculator
-
3regexp_substr has just been fixed to return the first match group,
regexp_substr('yourstring', 'DXFValue=(\\d*.\\d*)')
should now work. github.com/qgis/Quantum-GIS/commit/…Nathan W– Nathan W2013年08月08日 04:23:18 +00:00Commented Aug 8, 2013 at 4:23