Regex Overview
Regular expressions (Regex) are a powerful way to search, match, and manipulate text data. A regex code is essentially a pattern that defines how text should be identified.
In the Capital Projects Dashboard, you can use Regex to search within the Project Title, Type, Description, and Justification fields. This is especially useful when you need more advanced filtering logic than what’s available through the standard Project Keyword Search.
To craft a Regex pattern for use in the Capital Projects Dashboard, there are two ways you can do this:
-
Reach out to the Citylitics team with your list of keywords and desired logic, or
-
Create your own Regex code using the simple examples below.
Tips & Tricks
OR Logic |
When searching for projects that match any of several terms, use the pipe character | to separate them.
The following example will return projects containing either “energy sustainability” or “energy planning”.
energy (sustainability|planning)
Optional Matching (?)
You can make certain characters or spaces optional using ?.
waste( )?water
AND Logic (.*?)
To find projects that contain multiple keywords in the same text field (regardless of spacing or order), use the combination .*? between terms.
For example, this will return results where both “water” and “sewer” appear anywhere in the field, in either order.
(?i)((water.*?sewer)|(sewer.*?water))Summary
-
Use | for OR conditions
-
Use ? for optional elements
-
Use .*? for AND conditions
Regex gives you the flexibility to uncover exactly the right set of projects—whether you’re searching for specific combinations, variants, or phrases across multiple text fields.