# Search Console regex cheat sheet

Performance > Search results > + Add filter > Query or Page > Custom (regex)

## 15 regex filters

*Replace the example brand (Northwind) and the cities with your own. Test each pattern on real queries before you trust the numbers.*

| # | Filter | Pattern | Finds | Watch out for |
|---|---|---|---|---|
| 1 | Query, matches | `^(who\|what\|when\|where\|why\|how\|which\|can\|does\|is\|are\|should)\b` | Questions | Questions phrased later in the query ("tap repair how to") slip through |
| 2 | Query, matches | `(\S+ ){5}\S+` | Long-tail queries of 6+ words | Change {5} to tune the length; it counts words, not characters |
| 3 | Query, doesn't match | `north ?wind\|nortwind\|northwnd` | Everything except your brand (example brand: Northwind) | Add misspellings and product names; check the result for leftovers |
| 4 | Query, matches | `\b(vs\|versus\|alternatives?\|compare\|comparison)\b` | Comparisons and alternatives | "or" comparisons ("notion or obsidian") are too noisy to include |
| 5 | Query, matches | `\b(prices?\|pricing\|costs?\|cheap(est)?\|how much\|fees?)\b` | Price and cost searches | Without \b, "costume" and "priceless" sneak in |
| 6 | Query, matches | `near me\|nearby\|open now\|\b(in\|near) (leeds\|york\|hull)\b` | Local intent | Replace the cities with yours; a city alone also catches non-local queries |
| 7 | Query, matches | `\b20[0-9]{2}\b` | Queries with a year | Also catches model numbers and room numbers like "2050" |
| 8 | Query, matches | `ac+om+odation` | A word and its misspellings | Includes the correct spelling; pair it with an exact filter to isolate the errors |
| 9 | Query, matches | `\b[a-z]{1,3}-?[0-9]{3,}[a-z0-9]*\b` | Product codes and model numbers | Adjust to your SKU format; generic codes like "mp300" overlap with ordinary words |
| 10 | Page, matches | `/(blog\|guides)/[^/]+/?$` | Articles one level deep in two folders | Skips the folder's index page and pagination like /blog/page/2/ |
| 11 | Page, matches | `[?&](utm_[a-z]+\|sort\|sessionid\|ref)=` | URLs with tracking or sorting parameters | Use \? alone to see every URL with a query string |
| 12 | Query, matches | `\b(how to\|guide\|tutorial\|step by step\|examples?\|templates?)\b` | How-to and resource intent | "guide" won't match "guidelines" because of \b; add it if you want it |
| 13 | Query, matches | `\b(buy\|order\|for sale\|deals?\|coupon\|discount\|promo code)\b` | Buying intent | "order" also appears in informational queries ("order of operations") |
| 14 | Query, matches | `\b(not working\|error\|fix\|broken\|problems?\|won'?t\|can'?t)\b` | Problems and troubleshooting | Good for support content; spot-check for product names containing "fix" |
| 15 | Page, matches | `(?-i)[A-Z]` | URLs with capital letters | Needs (?-i); without it, every URL matches |

## Syntax

| Syntax | Meaning | Example | Matches |
|---|---|---|---|
| `a\|b` | Either side | `vs\|versus` | "notion vs obsidian" |
| `^ and $` | Start and end of the text | `^how` | "how to…", not "know how" |
| `\b` | Word boundary | `\bcost\b` | "roof cost", not "costume" |
| `?, +, {n}` | Optional, one or more, exactly n | `prices?` | "price" and "prices" |
| `[...] and .` | One character from a set, any character | `20[0-9]{2}` | "2026" |

## How the filter behaves

- The dialect is RE2: no lookahead, lookbehind or back-references. Use "Doesn't match regex" for exclusions.
- Matching is partial: a pattern matches anywhere in the query or URL. Anchor with ^ and $ when position matters.
- Matching ignores case by default. Start the pattern with (?-i) to make it case-sensitive.
- The Page filter sees the full URL, protocol and host included: use /blog/, not ^/blog.
- RE2's \b is ASCII-only: letters like é or ü count as non-word characters.
- Query filters drop anonymized queries, so a filter and its "doesn't match" twin won't add up to the unfiltered total.

## Your saved patterns

*Search Console has no library of saved filters. Keep one canonical version of each pattern here, especially the brand exclusion.*

| Name | Filter | Pattern | What it's for |
|---|---|---|---|
|  |  |  |  |
|  |  |  |  |
|  |  |  |  |
