Regex for SEO: A Guide for Non-Tech SEOs to Copy

Regular expressions are the closest thing Google Search Console has to a power-user mode. Most SEOs never touch them because the syntax looks intimidating.

It is not.

You copy a pattern, paste it into one filter, and GSC does work that used to mean exporting to Sheets.

You do not need to be technical. If a pattern needs tweaking, describe what you want to any current AI model and ask it for RE2 syntax that works in GSC.

Any model does this well now, so there is no need to pay for a specific one.

How to Use This Guide

There are two ways to use what follows.

  1. Copy a pattern straight into GSC.
  2. Or take one as a starting point and swap the words inside it.

Every pattern goes into the Performance report.

Open the report, add a filter, choose Query or Page.

Filters menu

Then pick the Custom (regex) option. Set it to Matches regex to keep what fits the pattern, or Doesn’t match regex to exclude it.

Query Regex Option

How Regex Actually Behaves in GSC

*Skip this section if you just want to copy-paste some Regex.

GSC runs on RE2, Google’s own regex engine. It behaves differently from the regex you copy off Stack Overflow. Five rules cover most of the pain.

  • Query data is lowercase. Capitals in a query pattern match nothing. Prefix with (?i) out of habit and stop thinking about case.
  • Matching is partial by default. Your pattern matches anywhere in the string unless you anchor it with ^ for the start or $ for the end. You rarely need .* wrappers.
  • Use word boundaries. Without \b, the pattern can matches “scan”, “candle”, and “cancer”. Adding \b fixes it.
  • No lookaheads, lookbehinds, or backreferences. RE2 does not support (?=...), (?<=...), or \1. Patterns that use them fail, usually with no error and no data. For “not this”, use the “Doesn’t match regex” option instead of a negative lookahead.
  • An empty report usually means a broken pattern, not no data. Test in Regex101 with the flavor set to Golang, which uses RE2.

Brand vs Non-Brand

This is my favorite regex, and the one I reach for first. It splits your queries into branded and non-branded, so you can see brand lift from a launch or a seasonal dip without guessing.

Build one pattern that holds your brand, its spelling variants, and its common misspellings.

(?i)(yourbrand|your brand|yourbrnad|common misspelling)

Replace the placeholders with your actual terms. For a brand like Microsoft it might look like this:

(?i)(microsoft|micrsoft|mircosoft|microsft|msft)

The fastest way to build a complete version:

  • Filter your queries to your homepage.
  • Export the queries and sort by clicks.
  • Pull out the branded terms and misspellings.
  • Paste them into an AI model and ask for a GSC-ready RE2 pattern.

Then use it two ways.

Branded Queries: Set the filter to Matches regex to see branded demand.

Non-Branded Queries: Change to Doesn’t match regex to see everything else, which is your non-brand universe.

GSC Built-in Brand vs Non-Brand

Since last year, Google Search Console includes a Branded and Non-Branded queries functionality, but I have found it to be lacking sometimes.

Brand Vs Non Brand

Use regex when you want to include or exclude specific variations of branded terms.

Question queries are the most common query fan-outs for AI search. These are the queries where a direct, well-structured answer wins the citation.

(?i)^(who|what|where|when|why|how|which|can|do|does|is|are|will|should)\b

Short questions are hard to rank for. Narrow to the long-tail versions, eight words or more, where the intent is clearer and the competition thinner:

(?i)^(who|what|where|when|why|how|which|can|do|does|is|are)\b(\W+\w+){7,}

*Change the number at {7,} for questions with more or less words. For example, conversational strings that show how AI-era search behaves, ten words or more:

^(\w+\s){9,}\w+$

Change the 9 to test other lengths. Push it much higher to isolate the unusually long, structured queries that can point to AI-assisted or machine-generated searches:

^(\w+\s){31,}\w+$

\w skips apostrophes, so contractions nudge the word count. Treat it as a cue to investigate.

Short-Tail and Long-Tail Queries

Word count is a fast proxy for intent and difficulty. Short queries are broad and competitive. Long queries are specific and easier to win.

Short-tail, one to four words:

^(\w+\s){0,3}\w+$

Long-tail, eight words or more:

^(\w+\s){7,}\w+$

Change the numbers to move the threshold wherever you want to test.

Intent Filters

Group your queries by what the searcher wants to do. Each of these goes in the Query filter. Together they turn a flat query list into a funnel.

Commercial and comparison (people weighing options):

(?i)\b(best|top|alternative|alternatives|vs|versus|compare|comparison|review|reviews|cheapest)\b
commercial intent regex

You can see my commercial intent queries using the same regex in the example above.

Local intent (people looking nearby):

(?i)\b(near me|nearby|near by|closest|close to me|in my area|open now)\b

Price and buying intent (people close to a decision):

(?i)\b(price|pricing|cost|how much|cheap|cheapest|discount|coupon|promo|deal|free trial|buy|for sale)\b

Content format (the shape of answer they want):

(?i)\b(template|checklist|cheat ?sheet|pdf|download|spreadsheet|calculator|generator|tool|example|guide|tutorial)\b

Year and freshness (people who want current information, and your cue to refresh a page):

\b20\d{2}\b

Countries and Languages (International SEO)

If you run a large multi-regional site, you have several solutions of monitoring Search results. You may need to have separate GSCs per region / language (using subdomains or foldering).

But, if you have a single Google Search Console for an international site, Regex can save you while looking for specific countries.

Regex runs on the Query and Page filters only, never on the Country dimension. For where the searcher is located, use the built-in Country filter.

To use Regex, you will need to look at the URL – subdomains or foldering sections. An example targeting German visitors:

de.mysite.com

or

mysite.com/de

Per-market performance by URL section

If your site folders by country or language, a Page regex isolates each market. Page matching is case-sensitive, and dots need escaping.

Subfolders on one domain:

^https://yourdomain\.com/(es|fr|de|it|pt|nl|pl)/

Any locale folder, wherever it sits in the path:

/(es|fr|de|it|pt|pt-br|en-gb|en-us)/

Locale subdomains:

^https://(es|fr|de|it)\.yourdomain\.com

Use ISO alpha-2 codes to match your own structure. To compare one market against everything else, run the same pattern with Doesn’t match regex.

Ready-made geo groupings

Three groupings people reach for most, each as one Page filter. Codes are ISO alpha-2. Fold by country and these pull the whole region in a single view.

Europe (the EU plus the UK, Switzerland, and Norway):

/(at|be|bg|hr|cy|cz|dk|ee|fi|fr|de|gr|hu|ie|it|lv|lt|lu|mt|nl|pl|pt|ro|sk|si|es|se|gb|uk|ch|no)/

Tier 1 (the wealthiest, highest-CPC markets, straight from the Tier 1 countries list):

/(au|at|be|ca|dk|fi|fr|de|ie|it|lu|nl|nz|no|es|se|ch|gb|uk|us)/

APAC (major Asia-Pacific markets):

/(au|nz|jp|cn|hk|tw|kr|sg|my|id|th|ph|vn|in|pk|bd|lk)/

Anchor any of them to your domain, and for language-region folders like /en-us/ or /de-ch/, match the region on the end:

^https://yourdomain\.com/(au|at|be|ca|dk|fi|fr|de|ie|it|lu|nl|nz|no|es|se|ch|gb|uk|us)/
/[a-z]{2}-(au|at|be|ca|dk|fi|fr|de|ie|it|lu|nl|nz|no|es|se|ch|gb|uk|us)/

Three notes before you paste:

  • gb is the ISO code for the United Kingdom, but many sites use /uk/, so both are in the patterns.
  • Bare two-letter codes are greedy. /it/ catches Italy and an IT section, /in/ catches India and an “in” folder, /id/ catches Indonesia and an id folder. Test against your real URLs first.
  • Want Tier 2 and Tier 3 as their own filters? Build them the same way off the full country tier list.

Geo-modified query intent

Different job. These catch searches where someone types a place into the box, like “crm software germany” or “melhor crm brasil”. Set the filter to Query and use (?i) because query data arrives lowercase. Include native spellings and unaccented variants, because people type both “españa” and “espana”. You can rebuild any of the three page groupings above as a query filter by swapping the ISO codes for country names.

North America:

(?i)\b(usa|u\.s\.a|united states|america|canada|mexico|méxico)\b

South America:

(?i)\b(brazil|brasil|argentina|colombia|chile|peru|perú|venezuela|ecuador|bolivia|paraguay|uruguay|guyana|suriname)\b

Spanish-speaking countries:

(?i)\b(espana|españa|mexico|méxico|argentina|colombia|chile|peru|perú|venezuela|ecuador|guatemala|cuba|bolivia|dominicana|honduras|paraguay|salvador|nicaragua|costa rica|panama|panamá|uruguay)\b

Portuguese-speaking countries:

(?i)\b(brasil|brazil|portugal|angola|mocambique|moçambique|cabo verde|guine|guiné)\b

One caveat, and it matters. Most local searches do not contain the country name. Someone in Spain searches “zapatos”, not “zapatos españa”. So this catches explicit geo-modified demand only, a slice, not the whole market. For true market performance, use the Country dropdown or the Page patterns above.

Product IDs and SKUs

For ecommerce, regex lets you track a series of products even when they sit across many URLs. Say your IDs look like A123, PR097, or ABC234. This pattern finds them:

^(A\d{3}|PR\d{3}|ABC\s?\d{3})$

Use it in the Page filter. Change the letter prefixes and digit counts to match your own SKU structure. The same idea groups any related set of pages: colors, clothing types, or content categories like guides and templates.

Misspellings

Misspellings work like the brand pattern, but for non-branded terms. Collect the variants you see in your query report, or ask an AI model for the common misspellings of a target word, then wrap them in one pattern.

(?i)(definately|definitely|seperate|separate|recieve|receive)

Swap in your own set. This surfaces demand you are quietly ranking for and shows where a corrected on-page mention could pick up easy impressions.

Make Some SEO Magic

These are a fraction of what regex can do inside Search Console. The point is not the patterns themselves. It is that a couple of minutes of setup replaces a routine you have been doing in Sheets. Branded versus non-branded, question demand, buying intent, and market-by-market performance are all one filter away.

A few of the patterns I used while updating the article were inspired by Amy Lynch‘s carousel, Head of SEO at Gravytrain.

5ef84ff0092b98207d2ef10131f6044fdbf3b2dd52e53afa8b3557a435164abc?s=150&d=mp&r=g
Website |  + posts

Nick Malekos is the Head of Growth & Demand Generation at Cyberbit, with a background in SEO, Content Marketing, and Performance. He is specializing in helping SaaS startups and scale-ups grow.