2

Is there a way to select the features of a map by finding text within an attribute table? For example, if several features are listed as "Nature preserve" under a column called "Category", can I select all these features using an expression like, "Category" contains '*nature*', or something similar?

1 Answer 1

3

Using the "select by expression" tool with the following expression

regexp_match("Category",'ature') > 0

will select all features where the string "ature" is found in the column "Category". I omitted the n because I actually don't know whether regexp is case-sensitive.

Replace "Category" with the actual name of your column.

The expression checks for > 0 because regexp_match returns the place where the string you search for starts, or 0 if the string isn't part of the attribute. So, everything where a value unlike 0 is returned contains the string you searched for.

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.