3

Is there a way to search for only parts of text in QGIS.

Imagine I have a field in my attributetable called myField and I have several entries there, something like

This is awesome
Even more awesome
Hard Faster Stronger
Rolling down

Is there a way to search only for awesome and get all the rows returned, where myField has a cell where the word awesome occurs?

4

You can easily achieve that with select by expression dialogue.

"my_field" LIKE '%specific_words%'

See this example

enter image description here

3

you can also use

strpos( "myField", 'awesome') > 0

and for case insensitive searches

strpos( lower("myField"), 'awesome') > 0

this is slightly more error-prone as you need to put double quotes around field names and single quotes around string values. I always fall into that trap.

I noticed that a recent version of QGIS (2.12?) has quietly introduced a 'fuzzy matching' category, with functions for Hamming Distance, Levenshtein distance and Soundex. These are useful if you want to match words which are nearly similar, or which sound similar...

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.