I am learning to use Python scripts to automate tasks in my work. I am a beginner in Python and PyQGIS.
I would like to select entities in a layer using regexp_match. It works well in QGIS but I can't transpose it into the Python script.
Could someone tell me how to do it?
Here is my current code:
query = "regexp_match(\"COD\" ,'\d.\d\d')" selshp = shp.getFeatures(QgsFeatureRequest().setFilterExpression(query)) shp.setSelectedFeatures([f.id() for f in selshp])
But no entities are selected while in QGIS I have 670 selected entities.