RegEx (short for “regular expression”) is a short pattern that tells a tool which words or web addresses to look for. You don’t need to learn it: copy a pattern below, paste it in, and change the example words to yours.
How to Use a Pattern in 3 Steps
- In your tool, choose the RegEx option. It may be called “matches RegEx”, “regex” or “regular expression”.
- Click Copy under a pattern below, then paste it in.
- If the pattern has example words in it, change them to your own words. Leave the symbols around them as they are. In a list, put a
|between each word.
Good to Know
- Capital letters: some tools ignore capital letters and some don’t. If yours doesn’t, look for an “ignore case” option, or type the pattern with the same capitals as your text.
- Web addresses: the patterns in the Websites table work on full web addresses, like
https://www.zillow.com/homes/. The first three also work on just the website name, likezillow.com. - Two patterns need a feature some tools don’t have. “Has none of these words” and “Has two words, in any order” use a lookahead, the
(?=or(?!part. Google Search Console and Looker Studio don’t support it, so those two patterns won’t work there.
Words
| To find text that… | Copy this pattern | Finds | Doesn’t find |
|---|---|---|---|
| Starts with certain words | ^real estate | Real Estate Agent | Tampa Real Estate |
| Ends with certain words | agency$ | Real Estate Agency | Agency of Tampa |
| Has any word from a list | \b(agent| | Mortgage broker | Home builder |
| Has none of these words | ^(?![\s\S]*\b(cheap| | Best homes | Free home value |
| Has a whole word, not part of a longer word | \bagent\b | Agent: Jo Smith | Real estate agents |
| Has a word, with or without an s on the end | \bagents?\b | Top agents in Tampa | Real estate agency |
| Has two words, in any order | ^(?=[\s\S]*real estate)(?=[\s\S]*agent) | Agent for real estate | Insurance agent |
| Has one word, then another later on | real estate[\s\S]*agent | Real estate team and agent | Agent for real estate |
Numbers and Questions
| To find text that… | Copy this pattern | Finds | Doesn’t find |
|---|---|---|---|
| Has a number anywhere | \d | Top 10 agents | Real estate agent |
| Starts with a number, like "10 Best…" | ^\d | 10 Best Agents in Tampa | Top 10 agents |
| Has a number from 2020 to 2029, like a year | \b202\d\b | Best agents of 2026 | Since 1999 |
| Has a price (a $ sign, then a number) | \$\d | Homes from $250,000 | Save money |
| Is a question (has a question mark) | \? | What does an agent do? Duties explained | How to pick an agent |
| Starts with a question word (how, what, is, can, do…) | ^(how| | Is Zillow accurate | Island homes |
Websites
The first three patterns work in both URL and domain fields. The last four work only in URL fields, which hold the full address. Keep the \ before each dot.
| To find text that… | Copy this pattern | Finds | Doesn’t find |
|---|---|---|---|
| Matches one domain | ^([a-z]+://)?([^/?#]*\.)?zillow\.com([/?#:]| | https:/ | https:/ |
| Matches any domain from a list | ^([a-z]+://)?([^/?#]*\.)?(zillow\.com| | realtor.com | trulia.com |
| Matches a .gov or .edu domain | ^([a-z]+://)?[^/?#]*\.(gov| | https:/ | https:/ |
| Has a folder in the URL, like /blog/ | /blog([/?#]| | https:/ | https:/ |
| Is a home page URL | ^https?://[^/?#]+/?(\?utm_[^#]*)?(#.*)?$ | https:/ | https:/ |
| Is a PDF URL | \.pdf([?#]| | https:/ | https:/ |
| Has utm_ tracking in the URL | [?&]utm_ | https:/ | https:/ |
One Tip: Words With Symbols in Them
If your words have any of these symbols in them, put a backslash (\) in front of each one: . * + ? ^ $ ( ) [ ] { } | \
For example, St. Pete becomes St\. Pete.