REFERENCE · FOR SEOS AND CONTENT TEAMS

Google Search Console Regex Cheat Sheet: 35 Tested Filters

Thirty-five tested regex filters for Google Search Console queries and pages, the RE2 rules that make copied patterns fail, and how to run the same patterns through the API with an AI assistant.

By GSC MCP Server teamUpdated 13 min read

How regex works in Google Search Console

Google Search Console regex is a filter in the Performance report that matches queries or page URLs against a regular expression. Open Performance → Search results, click + Add filter, choose Query or Page, then Custom (regex), and pick Matches regex or Doesn’t match regex. Search Console uses Google’s RE2 syntax, matches anywhere in the string unless you anchor the pattern with ^ or $, and ignores case unless the pattern starts with (?-i).

Those three rules come straight from Google’s help page on advanced filtering, and they explain most of the “my regex doesn’t work” complaints. A pattern written for JavaScript or PCRE may use features RE2 rejects, and a pattern without anchors catches more than you meant.

Regex arrived in the Performance report in 2021, and the negative option followed a couple of months later. Google’s announcement of “doesn’t match” filters suggested three uses that still hold: segmenting people who already know your brand, analysing a site section, and understanding intent from question or transactional words.

Where you can use regex

WhereQueriesPagesNotes
Performance → Search resultsYesYesThe table shows at most 1,000 rows
Performance → DiscoverNo query dataYesCustom (regex) on page URLs only
Search Analytics APIYesYesincludingRegex and excludingRegex
Bing Webmaster ToolsNoNoNo RE2 regex filter; segment exported rows instead

The Discover row is easy to miss: Google’s Discover report documentation confirms Custom (regex) for page URLs with the same RE2, partial-match and case rules.

RE2 syntax cheat sheet for Search Console

RE2 is Google’s regex engine. It is built to run in predictable time, so it drops a handful of features other engines have. Everything you need for search data is here; the full reference is the RE2 syntax page on GitHub.

SymbolMeaningExample
|ORseo|sem
( )Group alternatives(blue|red) trainers
^ and $Start and end of the string^how, \.pdf$
.Any single characterm.n matches man and men
* and +Zero or more, one or more of the previous item.*, \d+
?Previous item is optionalalternatives?
{n,m}Between n and m repeats (max 1,000)(\S+\s+){3,}
[abc] and [^abc]One of these characters, or any character except these[?&], [^/?#]+
\bWord boundary (ASCII letters, digits, underscore)\bvs\b
\d, \s, \SDigit, whitespace, non-whitespace/page/\d+
\., \?A literal dot or question markexample\.com
(?i) and (?-i)Case-insensitive or case-sensitive from here on(?-i)[A-Z]

What RE2 doesn’t support, and what to use instead

Not supportedLooks likeUse instead
Lookahead and negative lookahead(?=…), (?!…)Doesn’t match regex, or a second excludingRegex filter in the API
Lookbehind(?<=…), (?<!…)Same as above
Backreferences\1Spell the alternatives out
Possessive quantifiers, atomic groupsa*+, (?>…)Plain * and +; RE2 doesn’t backtrack, so you don’t need them
End of text before a newline\Z$
Repeat counts above 1,000x{1001}Keep counts at 1,000 or below

Case, accents and length

  • Case. The interface ignores case by default; (?-i) switches it on for the rest of the pattern. The API reference doesn’t say how its regex operators treat case, so when case matters in an API call, put (?i) or (?-i) at the start and remove the doubt.
  • Accents. \b only understands ASCII letters. In our tests \bcafé\b did not match “café paris”, because RE2 treats é as a non-word character. Use (^|\s)café($|\s) or drop the boundary.
  • Length. The Search Analytics API reference caps a filter at 4,096 characters. Google doesn’t publish a limit for the interface box, so treat claims of an exact UI limit with caution.

Regex for question, comparison and intent queries

Every pattern below was compiled and tested against sample queries with an RE2-syntax engine, with case-insensitive matching as in the interface. Paste them into Query → Custom (regex) → Matches regex unless the row says otherwise.

To findRegexExample it returns
Questions (query starts with a question word)^(who|what|when|where|why|how|which|can|does|do|is|are|should|will)\bis search console free
Question words anywhere in the query\b(who|what|when|where|why|how|which)\bsearch console how to add user
How-to and how-much queries^how (to|do|does|can|much|many|long)\bhow much does seo cost
Comparisons\b(vs|versus|compare[ds]?|comparison|difference between)\bnotion vs. obsidian
Alternatives and competitors\b(alternatives?|competitors?|similar to|instead of)\bcheaper alternative to hubspot
Best and top lists\b(best|top \d+|top-rated|top rated)\btop 10 seo tools
Reviews and trust\b(reviews?|ratings?|pros and cons|worth it|legit|scam)\bacme crm reviews
Price and buying intent\b(buy|price|prices|pricing|cost|costs|cheap|cheapest|deals?|discount|coupon|promo code)\bcrm pricing for 5 users
Problems and errors\b(not working|error|errors|fix|fixed|issue|issues|problem|broken|stuck)\bsitemap could not be read error
Conversational, AI-style queries\b(i want|i need|help me|should i|can i|is it possible|what should)\bshould i use a domain property or url prefix

Note the difference between the first two rows. The anchored version only catches queries that start with a question word; the unanchored one also finds “search console how to add user”, which is how many people actually type.

Local, year and navigational modifiers

To findRegexExample it returns
Local intent\b(near me|nearby|open now|closest)\bemergency plumber near me
Place names you serve\b(london|manchester|birmingham|leeds|glasgow)\bseo agency manchester
Year modifiers\b202[5-7]\bbest crm 2026
Navigational and support queries\b(login|log in|sign in|sign up|signup|careers?|jobs?|contact|customer service|phone number)\bacme login

Swap the place names for the towns you serve and roll the years forward each January. The navigational row is most useful with Doesn’t match regex, to strip login and careers searches out of a content analysis.

Try this prompt
Using query_search_analytics for example.com over the last 90 days, return queries matching the regex \b(who|what|when|where|why|how|which)\b with their landing pages. Group the questions by page, show clicks, impressions and position, and flag questions that no page answers directly.

Question queries on page two are often the quickest wins; the striking distance keywords playbook shows how to prioritise them, and our guide to keyword research with Search Console turns the rest into content.

Regex for long-tail queries by word count

Search Console has no “words in query” filter, but \S+ (a run of non-space characters) is a word, so you can count them. ^(\S+\s+){3,}\S+$ reads as “three or more words each followed by a space, then a final word”, which is four words or more.

To findRegexExample it returns
One-word queries^\S+$crm
Two to three words^\S+(\s\S+){1,2}$crm for startups
Four words or more^(\S+\s+){3,}\S+$best crm for startups
Seven words or more^(\S+\s+){6,}\S+$how do i move search console to a new domain

Long queries are worth watching for a newer reason too. In AI Mode a follow-up question counts as a new query, according to Google’s explanation of Performance report metrics, so conversational, multi-clause queries can appear in your data alongside classic keywords. Track the seven-plus bucket over time rather than guessing.

Try this prompt
For example.com, use multicall to run query_search_analytics four times for the last 90 days with dimensions date: once each with includingRegex filters for one-word, two-to-three-word, four-to-six word and seven-plus word queries. Sum clicks and impressions by month for each bucket and show each bucket’s share of the classified total.

For the four-to-six bucket, ask the assistant to use ^(\S+\s+){3,5}\S+$. Shares are calculated against the sum of the buckets, not the property total, for reasons covered in what regex can’t show you.

Regex for branded, non-branded and competitor queries

The examples use a fictional brand, Acme, with products called Rocketboard and Skyledger. Replace the names with yours and add the misspellings that actually appear in your query list, not the ones you imagine.

To findRegexExample it returns
Brand name and misspellings\b(acme|akme|acmee|acmi|ackme)\bakme pricing
Brand, domain and product names\b(acme|akme|acmee|acmeapp|rocketboard|skyledger)\brocketboard templates
Non-branded queries (same pattern, set to Doesn’t match regex)\b(acme|akme|acmee|acmeapp|rocketboard|skyledger)\bcrm for startups
Brand plus navigational words\b(acme|akme)\b.*\b(login|log in|sign in|pricing|support|reviews?)\bacme crm pricing
Competitor brands\b(hubspot|salesforce|pipedrive|zoho)\bpipedrive pricing
Competitor comparisons and alternatives\b(hubspot|salesforce|pipedrive)\b.*\b(vs|versus|alternatives?)\b|\balternatives? to (hubspot|salesforce|pipedrive)\balternatives to pipedrive

Search Console now has a native branded queries filter, but Google classifies it with AI, shows it only on eligible top-level properties and doesn’t expose it in the API. A brand regex is the transparent alternative that works everywhere. Our guide to branded vs non-branded queries in Search Console covers building and reporting it in full.

Try this prompt
List queries for example.com from the last 90 days that look like our brand “Acme” or our products Rocketboard and Skyledger, including misspellings and joined-up spellings. Propose one RE2 brand regex with word boundaries and no lookarounds, then run it with excludingRegex and show the top 50 remaining queries so I can spot brand terms it missed.

Regex for page URLs: folders, parameters and locales

Page filters match the full URL Search Console reports, protocol and host included. Check the exact format on the Pages tab before you anchor anything: a Domain property can show https://www., bare-domain and subdomain URLs side by side.

To findRegexExample it returns
One folder, anchored to your host^https://www\.example\.com/blog/https://www.example.com/blog/regex-guide
Several folders at once/(blog|guides|resources)/https://www.example.com/guides/setup
Homepage only^https://www\.example\.com/?$https://www.example.com/
Pages one level inside a folder/products/[^/?#]+/?$https://www.example.com/products/blue-trainers
URLs with any parameter\?https://www.example.com/shoes?size=9
Tracking and click-ID parameters[?&](utm_[a-z]+|gclid|fbclid|msclkid)=https://www.example.com/?utm_source=newsletter
Pagination/page/\d+/?$|[?&]page=\d+https://www.example.com/blog/page/3/
Language or locale folders^https://www\.example\.com/(fr|de|es|it)(-[a-z]{2})?/https://www.example.com/de-at/preise
Subdomains (Domain property)^https://(blog|shop|help)\.example\.com/https://help.example.com/billing
Files: PDFs and documents\.(pdf|docx?|xlsx?|pptx?)$https://www.example.com/files/price-list.pdf
URLs with capital letters(?-i)[A-Z]https://www.example.com/Blog/Regex-Guide

The parameter rows double as a canonical check. Search Console assigns most data to the canonical URL, as its documentation on dimensions explains, so tracking-parameter URLs that earn impressions usually mean Google picked them as canonical. Confirm with inspect_url, which reports the Google-selected and user-declared canonicals side by side.

Page regex also helps spot pages fighting over the same queries: add a page pattern for one folder, group by query, and look for repeats. The keyword cannibalization guide walks through the fixes. Folder patterns are just as useful after a URL change: compare old and new folders during site migration SEO monitoring.

Why your Search Console regex isn’t working

Google’s Discover help notes that invalid regex syntax returns no matches, so a broken pattern often looks like “no data” rather than an error. These are the mistakes we see most:

  1. Unsupported syntax. Lookaheads such as ^(?!.*acme), often suggested by chatbots and Stack Overflow answers, aren’t RE2. Use Doesn’t match regex instead.
  2. Spaces around the bar. (seo | ppc) looks tidy, but the spaces are part of the pattern: it needs “seo” followed by a space or “ppc” preceded by one, so the query “ppc” on its own doesn’t match. Write (seo|ppc).
  3. Using * as a wildcard. seo*tools means “se, any number of o’s, then tools”, so it misses “seo tools”. The wildcard is .*.
  4. Unescaped dots and question marks. In /shoes?size the ? makes the s optional. Escape it as \?, and write domains as example\.com.
  5. Forgetting partial matching. seo also matches “seoul hotels”. Wrap whole words in \b.
  6. Anchoring to the wrong host. ^https://example\.com/ returns nothing if your URLs are reported on www.
  7. Smart quotes and invisible characters. Patterns pasted from documents can carry curly quotes or non-breaking spaces. Type them into a plain-text editor first.

Run the same regex through the API with AI

The Search Analytics API takes the same RE2 patterns through two filter operators, includingRegex and excludingRegex. Three details matter in practice:

  • Filters are combined with AND. Within a filter group, the API supports only “and”; “or” is listed as not yet supported. Put alternatives inside one pattern with |, and use a second filter to exclude.
  • Backslashes double in JSON. A raw API request is JSON, so \b becomes \\b: {"dimension": "query", "operator": "excludingRegex", "expression": "\\b(acme|akme)\\b"}
  • You get past 1,000 rows. The interface stops at 1,000 rows; the API returns up to 25,000 per request and pages with startRow.

GSC MCP Server wraps this in a read-only tool, query_search_analytics, so Claude, ChatGPT or Cursor can build the request for you. It takes up to four dimensions (query, page, country, device, date, searchAppearance), up to ten filters with the operators above, a searchType (web, image, video, news, discover or googleNews), and returns up to 1,000 rows per call with startRow for the next page; each page is one tool call. The raw API now calls the search type field type; the tool handles that for you. If you are new to the idea, start with what a Search Console MCP server is.

Try this prompt
For example.com over the last 28 days, find question queries that don’t mention our brand: use query_search_analytics with an includingRegex filter ^(how|what|why|which|can|is|does)\b and an excludingRegex filter \b(acme|akme|rocketboard)\b on the query dimension, grouped by query and page. Page through with startRow until there are no more rows, then list the 30 questions with the most impressions.

AI assistants are also good at writing regex, as long as you tell them the engine. Ask for “RE2, no lookarounds or backreferences” and make them prove the pattern on your data:

Try this prompt
Write an RE2 regex for Search Console that matches comparison queries (vs, versus, compare, alternatives) but not our brand. Then run it with query_search_analytics on example.com for the last 90 days and show me 20 matched queries and 20 near misses, so I can check it before I use it in a report.
Try this prompt
Using query_search_analytics with searchType discover and dimensions date, compare daily Discover clicks for pages matching /(news|guides)/ with all other pages on example.com over the last 90 days.

What regex can’t show you

  • Anonymized queries. Rare queries are hidden for privacy. They still count in chart totals, but not once a query filter is applied, so a branded segment plus a non-branded segment will add up to less than the total. Our guide to Search Console metrics explains why totals don’t match.
  • Every row. Search Console stores the most important rows, not all of them, and the API “does not guarantee to return all data rows”. Regex segments are excellent for trends and shares, less so for exact totals.
  • Meaning. A regex sees characters, not intent. It can’t tell that “gmail” is a Google brand query unless you list it, which is what Google’s AI-classified branded filter tries to do.
  • AI Overview queries. The Generative AI performance report has no query dimension and isn’t in the API, so no regex can isolate queries that showed an AI Overview. See the guide to the Generative AI report for what it does show.
  • Bing. GSC MCP Server’s get_search_queries with provider: "bing" returns top Bing queries, and the assistant can apply your pattern to those rows; it is a client-side match on the rows returned, not a Bing filter.

Regex is the backbone of most repeatable Search Console analysis. The same patterns power a content decay audit, a traffic drop diagnosis and many of the Search Console prompts for Claude and ChatGPT we use every week.

Frequently asked questions

Is Google Search Console regex case-sensitive?

No. In the Performance report, regex matching ignores case by default. Start the pattern with (?-i) to make everything after it case-sensitive, for example (?-i)[A-Z] to find page URLs that contain capital letters.

What is the character limit for regex in Search Console?

Google’s Search Analytics API reference caps a filter expression at 4,096 characters. Google’s help centre doesn’t publish a separate limit for the regex box in the interface, so if a pattern grows very long, such as a large brand list, move it to the API.

Can I use regex in the Discover or News reports?

The Discover performance report supports Custom (regex) on page URLs, but Discover has no query data, so query regex is a Search results feature. For anything the interface can’t do, the Search Analytics API accepts includingRegex and excludingRegex filters on both queries and pages.

Can I combine include and exclude regex filters?

In the API, yes: every filter in a request must match, so an includingRegex and an excludingRegex filter on the query dimension return, for example, question queries that don’t mention your brand. A single RE2 pattern can’t do this because RE2 has no negative lookahead. Google’s help doesn’t document stacking two query filters in the interface.

Why does my Search Console regex return no results?

The usual causes are unsupported syntax such as lookaheads or backreferences, spaces around the | separator, an unescaped dot or question mark, or an anchor that doesn’t match how Search Console writes your URLs. Google’s help notes that invalid regex syntax returns no matches.

Does Bing Webmaster Tools support regex filters?

Bing Webmaster Tools doesn’t offer an RE2 regex filter like Search Console’s. To segment Bing queries by pattern, export them, or pull them into an AI assistant and apply the same regex to the returned rows.