Table of contents
Learning how to use regex in Google Search Console starts in the Performance report: add a Query or Page filter, choose "Custom (regex)" and paste an RE2 (Google's regex syntax) pattern. I compiled every pattern in the cheat sheet below in RE2 and ran each one against labeled test queries and princedewani.online URLs.
This guide covers the filter path, the RE2 rules and limits, a copy-paste cheat sheet, question and long queries, branded queries, page folders, the Search Console API and fixes for patterns that won't apply.
How do you add a regex filter in Google Search Console?
A Google Search Console regex filter is the "Custom (regex)" option of a Queries or Pages filter, which keeps or hides every row matching a regex (regular expression, a text pattern). You add the filter in the Performance report from "+ Add filter", pick "Queries" or "Pages", paste the pattern and choose "Matches regex" or "Doesn't match regex".[1]
The full custom regex path in Google Search Console is Performance, "+ Add filter", "Queries" or "Pages", "Custom (regex)", your pattern, the match option and "Apply".
I track performance in Google Search Console, GA4 (Google Analytics 4), Ahrefs, Semrush and Profound, so I judge a regex filter by whether it returns only the queries or pages its name promises.
Which RE2 regex rules and limits does Search Console follow?
Google Search Console regex uses the RE2 syntax, matches anywhere in the query or URL unless you anchor the pattern with ^ or $, and ignores letter case unless the pattern starts with (?-i).[1] RE2 also leaves out lookarounds and backreferences, and rejects repeat counts above 1000.
- Partial match: The pattern seo matches "seo kpis" and "best seo tools", while ^seo$ matches only the query "seo".
- Case: A Search Console regex ignores upper and lower case by default, and (?-i)SEO matches "SEO kpis" but not "seo kpis".
- No lookarounds: RE2 does not support lookahead such as (?!re) or lookbehind such as (?<=re).[2]
- No backreferences: A pattern like (\w+) \1, which repeats an earlier match, fails in RE2, whose syntax page marks backreferences as not supported.
- Repeat limit: RE2 rejects a counted repeat such as {1001,} whose minimum or maximum count is above 1000.
- Word edges: In RE2, \b matches at a word boundary, so ^(is|can)\b skips "isabel marant" and "canva seo".
I checked these rules in google-re2, the Python package for Google's RE2 library. RE2 rejected ^(?!.*prince).*$ with the error "invalid perl operator: (?!" and rejected (\w+) \1 with "invalid escape sequence: \1".
How to use regex in Google Search Console: which patterns can you copy?
The Google Search Console regex patterns most worth copying are a question-word filter, a word-count filter for long queries, a brand-name pattern run with both match options, and folder patterns for page URLs. The table below gives each RE2 pattern with its filter (Query or Page) and match option, in 13 rows.
Example patterns, written for princedewani.online (swap in your own domain and brand):
| Goal | Pattern | Filter | Match option |
|---|---|---|---|
| Question queries | ^(who|what|when|where|why|how|which|can|does|is|are|should)\b | Query | Matches regex |
| Queries of 6+ words | ^(\S+\s+){5,}\S+$ | Query | Matches regex |
| Queries of 10+ words | ^(\S+\s+){9,}\S+$ | Query | Matches regex |
| AI-style prompts | ^(write|explain|compare|summarize|list|give me|act as|create|generate)\b | Query | Matches regex |
| Brand and misspellings | prin[cs]e? ?dewan[iy]? | Query | Matches regex |
| Non-branded queries | prin[cs]e? ?dewan[iy]? | Query | Doesn't match regex |
| Buyer words | The buyer pattern in my SEO for lead generation guide | Query | Matches regex |
| Uppercase only | (?-i)SEO | Query | Matches regex |
| One folder | ^https://princedewani\.online/blog/ | Page | Matches regex |
| Folder anywhere in the URL | /tools/ | Page | Matches regex |
| Homepage only | ^https://princedewani\.online/(\?.*)?$ | Page | Matches regex |
| Parameter URLs | \? | Page | Matches regex, or Doesn't match regex to hide them |
| Exact page set | ^https://princedewani\.online/blog/(seo-kpis|content-audit)/$ | Page | Matches regex |
I ran every pattern in the table in RE2 against 22 test queries I wrote and 8 princedewani.online URLs. Each pattern matched exactly the strings I had labeled for it, with 0 false matches and 0 misses.
Which regex filters find question queries and long queries?
In Google Search Console, a Query filter with "Custom (regex)" finds question queries with a pattern that anchors a question word at the start, ^(who|what|when|where|why|how|which|can|does|is|are|should)\b. The pattern ^(\S+\s+){5,}\S+$ finds long queries by counting words and keeps queries of 6 or more words, and {9,} in place of {5,} keeps queries of 10 or more words.
- Question words: Google's own Search Central blog suggests a question-word filter to see which queries your content should answer, for example through an FAQ.[3]
- Word count: In ^(\S+\s+){5,}\S+$, \S+ is one word, \s+ is the space after it, and {5,} asks for 5 or more word-and-space pairs before the last word.
- Prompt-like queries: Queries of 10 or more words, or queries that open with a command such as "write" or "explain", read like an AI chat prompt typed into Google.
- Pages tab: After a query filter is applied, the "Pages" tab shows which pages those question or long queries reach.
I do keyword research and SERP (search results page) analysis, so I judge a question filter by whether each question it returns maps to a heading or FAQ on the page that ranks.
How do you split branded and non-branded queries with regex?
Search Console has a built-in branded queries filter, which my SEO KPIs guide covers, but Google does not offer that filter on sites with a low number of impressions.[4] On those sites, one regex with your brand name and its misspellings splits branded from non-branded queries: "Matches regex" shows the branded queries, and "Doesn't match regex" shows the non-branded queries.
- Branded view: Paste the brand pattern with "Matches regex" to see the queries that name your brand.
- Non-branded view: Paste the same pattern with "Doesn't match regex" to see every query that does not name your brand.
- Misspellings: Google's Search Central blog suggests listing every variant of the company name, misspellings included, in one pattern joined by the | character.
- Character classes: In prin[cs]e? ?dewan[iy]?, [cs] accepts "c" or "s", and each ? makes the letter or space before it optional.
In my RE2 test, prin[cs]e? ?dewan[iy]? caught all 5 brand spellings, including "prinse dewani" and "princedewani". The "Doesn't match regex" version kept the other 17 test queries and let 0 brand spellings through.
Which regex filters group pages by folder or page type?
In Google Search Console, a Pages filter runs against the full page URL, so a folder pattern either starts with the protocol and domain, like ^https://princedewani\.online/blog/, or drops the ^ and matches the folder anywhere, like /tools/. Google's own case-sensitivity example on its help page matches a full URL that starts with https://.[1]
- Page type: A folder pattern such as /blog/ or /tools/ splits blog posts from tool pages, and ^https://princedewani\.online/(\?.*)?$ keeps only the homepage.
- Parameter URLs: The pattern \? matches any URL with a query string (the part after ?), such as a ?utm_source= campaign link.
- Exact page set: A group in parentheses with ^ and $, such as (seo-kpis|content-audit)/$, keeps only the listed pages.
- Topic clusters: Folder patterns can also measure a whole topic cluster, which my topical authority guide covers.
I run technical, on-page and programmatic SEO (search engine optimization) across SaaS (software as a service) web properties, so I judge a page pattern by whether it isolates one page type on its own.
How do you use regex filters in the Search Console API?
The Search Console API (application programming interface) takes regex in its searchAnalytics.query method through 2 operators: includingRegex, an RE2 pattern that must match, and excludingRegex, an RE2 pattern that must not match.[5] You set either operator on a query or page filter inside dimensionFilterGroups.
Example request body that returns question queries for princedewani.online:
POST https://www.googleapis.com/webmasters/v3/sites/https%3A%2F%2Fprincedewani.online%2F/searchAnalytics/query
{
"startDate": "2026-01-01",
"endDate": "2026-03-31",
"dimensions": ["query"],
"dimensionFilterGroups": [{
"filters": [{
"dimension": "query",
"operator": "includingRegex",
"expression": "^(who|what|when|where|why|how|which)\\b"
}]
}],
"rowLimit": 25000
}- Escaping: Inside a JSON (JavaScript Object Notation) string, every backslash is written twice, so the pattern \b becomes \\b.
- Length: The API accepts at most 4096 characters per filter.
- Rows: The rowLimit field runs from 1 to 25,000 rows and defaults to 1,000.
- All filters must match: Every filter in a group must match, and the "one or more must match" option is not yet supported, so put each either-or choice inside one pattern with |.
Why won't a Search Console regex pattern apply?
A Search Console regex pattern fails or returns nothing when it uses a feature RE2 lacks, carries a stray space, misses an escape, or anchors a page pattern to a path instead of the full URL. Check the pattern against this list before you rewrite it.
- Lookarounds: A pattern with (?! or (?<= fails in RE2, so use "Doesn't match regex" with the plain pattern instead.
- Spaces around |: Spaces are literal characters, and in my RE2 test ^(seo kpis | content audit)$ matched neither query, while ^(seo kpis|content audit)$ matched both.
- Unescaped dots: A plain . matches any character, so princedewani.online also matched "princedewaniXonline" in my test; write \. for a real dot.
- Path-only anchors: ^/blog/ matches no page, because every page URL starts with https://.
- Lower totals: A query filter leaves anonymized queries out of the totals, so a filtered chart can show fewer clicks than the sum you expect.
- Huge repeats: A counted repeat above 1000, such as {1001,}, fails to compile in RE2.
Where should you start learning how to use regex in Google Search Console?
Start in the Google Search Console Performance report with the question-word pattern on a Query filter and a Pages filter for your top folder. Once you know how to use regex in Google Search Console, run the brand pattern with both match options and feed those filtered views into a page-by-page review.
My content audit guide shows how to pull Search Console and GA4 data into an audit and decide which pages to keep, update, merge or delete.
Resources and References Used for Research
- [1] Performance report (Search results): Advanced filtering and comparison - Google Search Console Help (2026)
- [2] Syntax - google/re2 Wiki, GitHub (Aug 2023)
- [3] Search Console regex filters update and quick tips - Google Search Central Blog (Jun 2021)
- [4] Performance report (Search results): Dimensions and data groupings - Google Search Console Help (2026)
- [5] Search Analytics: query - Google for Developers (2026)
Search Console Regex FAQs
Does Google Search Console support regex?
Yes, Google Search Console supports regex in the Performance report through the Custom (regex) option of a Queries or Pages filter. The filter reads patterns in RE2, Google's regex syntax, and offers 2 match options: Matches regex keeps the matching rows, and Doesn't match regex hides them. The Search Console API offers the same choice through its includingRegex and excludingRegex operators.
Is the Google Search Console regex filter case-sensitive?
No, the Google Search Console regex filter ignores letter case by default, so seo, SEO and Seo all match the same queries. To make a pattern case-sensitive, start it with (?-i). For example, (?-i)SEO matches a query that contains SEO in capitals but skips the same query typed in lowercase letters.
Why does Search Console reject a regex that ChatGPT wrote?
Search Console rejects an AI-written regex when the pattern uses a feature that RE2 does not support. Lookahead such as (?!...), lookbehind such as (?<=...) and backreferences such as \1 all fail to compile in RE2. Rewrite the pattern without them, and use the Doesn't match regex option when you want to exclude a word.
How do you exclude queries with regex in Search Console?
To exclude queries with regex in Search Console, add a Queries filter, choose Custom (regex), paste the pattern for the words you want to drop and pick Doesn't match regex. For example, a brand-name pattern with Doesn't match regex shows only non-branded queries. One pattern joined with the | character can exclude several words at once.
Can you filter Search Console pages by URL with regex?
Yes, a Pages filter with Custom (regex) filters Search Console data by page URL. The pattern runs against the full URL, including https:// and the domain. A pattern such as ^https://princedewani\.online/blog/ keeps one folder, and a pattern such as /tools/ matches that folder anywhere in the URL.
How long can a Search Console regex be?
Google's Performance report help page states no length limit for a regex, but the Search Console API accepts at most 4096 characters per filter. Inside any pattern, RE2 also rejects a counted repeat above 1000, such as {1001,}. Grouping shared parts, such as blog/(seo-kpis|content-audit) instead of 2 full URLs, keeps a pattern short and easier to check.


