1

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=C$5 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

3

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

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.