I've got a folder full of dxf files with elevation values included as part of a long text attribute. I've written a regex expression to extract the elevation value, and would like to add it as a new attribute to an output Mapinfo file.

I'd prefer to complete this using command line and ogr if possible, as it's already doing most of the work to convert the files. Python alternatively. QGIS as a last resort.

Could this be completed using a SQL query in the ogr2ogr command?

1 Answer 1


AFAIK OGR SQL doesn't support regular expressions natively, but...

By default, the REGEXP operator has no implementation in SQLite. With OGR >= 1.10 built against the PCRE library, the REGEXP operator is available in SQL statements run by OGR.

Source: http://www.gdal.org/ogr/drv_sqlite.html

However, see also:

Alternatively, you can use the LIKE operator and the SUBSTR function in your OGR SQL statements.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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