Regex generator for Search Console and GA4 filters
Short answer You rarely need a separate regex generator. Search Console's experimental AI configuration (if you see it) or any AI chatbot can write the pattern, and regex101's free tester checks it. Tell the tool where it goes: Search Console matches anywhere in a query and ignores capitals; GA4 must match the whole value and counts capitals.
Want help applying this to your business? Talk it through on a free 30-minute call.
Book a callWhich regex generator to use
You don't need a dedicated generator. A regex (regular expression) is a short pattern that matches many pieces of text at once, such as every search that names one of your towns. The routes below cover what a small business needs; the hard part is telling the tool which product the pattern is for.
| Route | Cost | Good for | Limits |
|---|---|---|---|
| Search Console's AI-powered configuration | Free, inside Search Console | Describe the report you want in plain words; it can add a regex filter | Experimental; Google says only a small share of users see it; 20 requests a day; Search results Performance report only |
| An AI chatbot (ChatGPT, Gemini, Claude) | Your existing plan | Any pattern, for either tool | Doesn't see your data; may use syntax Search Console rejects |
| regex101.com | Free tester; explanations and its AI assistant need Pro | Testing a pattern on real searches or page paths | Choose the Golang flavor to match Search Console's rules |
| By hand, from the lists below | Free | Brand, towns, questions, page sections | A few symbols to learn |
To use Google's tool, click the filter icon at the top of the Performance report, type a request and confirm the filters it suggests. In Google's own example, "queries that include common animal names" became a query filter matching a regex. Google adds:
"Since this is an AI feature, the tool may generate filters that don't match your request. Always review the filters applied to the report to ensure they match your intended query." (Search Console Help: Performance report, advanced filtering and comparison)
Search Console vs GA4: why the same pattern fails
They read patterns differently, so a pattern that works in one can return nothing in the other.
| Search Console | GA4 | |
|---|---|---|
| What must match | Any part of the query or URL | The whole value |
| Capital letters | Ignored by default | Count by default |
| Where you type it | Performance report: Queries or Pages filter, Custom (regex) | Data filters, key events, segments, audiences, content groups, custom channel groups |
Search Console's help page states the first rule:
"Default matching is a "partial match." Your regular expression can match anywhere in the target string unless you use ^ (start of string) or $ (end of string)." (Search Console Help)
GA4 is the opposite. Google's Analytics help says GA4 regex is a full match and case-sensitive by default: the pattern India matches only "India", and India.* matches any value that starts with India. So to move a Search Console pattern into GA4, add .* at both ends: (plano|frisco) becomes .*(plano|frisco).*
Two symbols trip everyone in both tools. A dot means "any character" and a question mark means "the character before is optional", per Google's RE2 syntax reference. To mean a real dot or question mark, put a backslash before it: example\.com, \?
Search Console regex patterns to copy
In the Performance report, click + Add filter, choose Queries or Pages, then Custom (regex). For several values, Google's help says to separate them with a vertical bar and wrap the whole thing in parentheses. Swap in your own words:
- Searches without your business name (Queries, choose Doesn't match regex): (bluestone|blue stone|bluston)
- Questions: ^(how|what|why|when|where|who|can|does|is)\s
- Price shoppers: (cost|price|how much|cheap|quote|estimate)
- Towns you serve: (plano|frisco|allen|mckinney)
- Long, conversational searches (six words or more): (\S+\s+){5}\S
- One section of your site (Pages): /services/
- Several pages at once (Pages): /(drain-cleaning|water-heater-repair)/
- Everything except the blog (Pages, Doesn't match regex): /blog/
For the brand pattern, Google's tip:
"Use regex that specify multiple variants of your company name, including misspellings." (Google Search Central Blog, June 2021)
Before you write one, check the query filter for Branded and Non-branded. Google's branded filter is "determined by an internal, AI-assisted system" and works only for top-level properties (not a URL path or subdomain) with enough queries and impressions. Since March 11, 2026, every eligible site has it. If yours doesn't, use the pattern above.
GA4 regex patterns to copy
Pick "matches regex" as the condition, for example in a custom channel group. Every pattern must cover the whole value:
- All service pages (page path): /services/.*
- Thank-you pages, for a lead segment or audience (page path): /(thank-you|thanks|booking-confirmed)/?
- Visits from AI assistants (source, in a custom channel group): .*(chatgpt|perplexity|gemini|copilot|claude).*
- Facebook, any capitalization (source): .*[Ff]acebook.*
How to get a chatbot to write a regex that works
Tell it the product and its rules, or it guesses. Give it these four lines:
- "Write a regular expression for a Google Search Console query filter. It uses RE2 syntax, matches anywhere in the query and ignores capital letters."
- "Match searches containing: [your words, misspellings, towns]."
- "Don't use lookaheads, lookbehinds or backreferences."
- "Give me 5 searches it should match and 5 it shouldn't."
For GA4, change the first line to: "Write a regular expression for a Google Analytics 4 'matches regex' condition. It must match the whole value and is case-sensitive."
Then scan the answer. RE2's syntax reference marks these NOT SUPPORTED, so Search Console can't run them:
- (?= or (?! — lookaheads, meaning "followed by" or "not followed by"
- Lookbehinds, which open with (? and a less-than sign
- \1 or \2 — backreferences, meaning "the same text again"
If the chatbot used a lookahead to leave something out, delete that part and choose Doesn't match regex instead.
How to test a regex before you trust the numbers
- Apply it and read the rows. Every query or page shown should belong.
- Flip it. In Search Console, switch to Doesn't match regex and scan the top rows for what you meant to catch, such as a misspelled brand name.
- Test outside the report when it matters, for example before building a GA4 audience. Paste the pattern and 20 real values, one per line, into regex101's free tester and choose the Golang flavor: Go's regexp package accepts "the syntax accepted by RE2", per its documentation. For Search Console, start the pattern with (?i) to ignore capitals. For GA4, wrap it as ^(...)$ to demand a whole-value match.
- Don't expect filtered rows to add up. Search Console says filtering by query or URL can change report totals, because of data truncation and anonymized queries.
Example
Illustrative cases with invented numbers.
A plumber in Texas splitting brand searches from the rest
Bluestone Plumbing had 900 clicks in three months. Query filter, Doesn't match regex, (bluestone|blue stone|bluston): 350 clicks remain. Those came from people who didn't search for the name: the number SEO work is meant to grow.
A physiotherapy clinic in Toronto checking its neighbourhoods
The query filter (etobicoke|mississauga|north york) shows 40 clicks in three months, nearly all to the homepage. No page speaks to those areas yet.
A dental office whose GA4 segment showed zero
The office manager typed thank-you with "matches regex" on page path. GA4 needs the whole value, and the real path is /thank-you/, so nothing matched. /thank-you/? fixed it: 25 form leads last month.
FAQ
Is there a free regex generator for Google Search Console?
Yes, if your account shows it: Search Console's AI-powered configuration writes filters from plain words, 20 requests a day. Otherwise ask any AI chatbot, then test the result in regex101 with the Golang flavor.
Why does my GA4 regex return no data?
Check three things. GA4 matches the whole value, so add .* at both ends; it counts capital letters; and a dot matches any character unless you put a backslash before it.
Can I use a lookahead in Search Console?
No. Search Console uses RE2, which doesn't support lookaheads, lookbehinds or backreferences. To leave queries out, choose Doesn't match regex.
Do I still need regex for branded searches?
Only if Search Console doesn't show you its Branded and Non-branded filter. Google offers it to top-level properties with enough queries and impressions.
Different for you?
- Search Console isn't set up, or you don't know which reports to read: Google Search Console for a small business.
- GA4 doesn't count calls, forms and bookings yet: GA4 key events for a small business.
- You want a monthly check that SEO is working: is my SEO working?
- You're choosing which searches to go after: keyword research for a local business.
- Town searches all land on your homepage: city pages for service areas.
- You'd rather have the tracking and reports set up for you: Conversion Agent.