Time to read: 9 minutes

Updated April 3, 2026

If you have been on a mission to gain more insights into search behavior, you need to dive into the world of custom regular expressions. By using custom regular expressions (RegEx) in Google Search Console (GSC), you can open up new insights on user search behavior by filtering queries.

After seeing a post on X (formerly Twitter), we decided to make this guide containing various RegEx code for you to utilize.

How to Apply RegEx Filters in GSC

Basically, a RegEx is a series of literal and meta-characters that can be used to search for text. With that in mind, let’s start with the basics: where to apply these filters. Once you are in Google Search Console, the process is as follows:

  1. Navigate to the “Search Results” report under the Performance tab in GSC
  2. Click on “+ NEW” button located above the chart of queries
  3. Select “Query…” from the dropdown
  4. Choose “Custom (RegEx)” and enter one of the patterns listed below

regex for search console

  1. Enter any of the custom codes mentioned below, then hit apply to gain valuable insights

Different RegEx Queries to Try to Up Your GSC Game

Now that you understand where to apply the filters, let’s get into the good stuff, which are the queries themselves. There are many different types of queries to try that can help you better understand how users are finding your content, all of which populate different results like location-specific terms, question terms, and so much more.

Frequently asked questions

Code to copy: ^(who|what|where|when|why|will|was|can|does|if|is|do|how|should|could|did)

Many searches find information by using questions. This question-based RegEx code captures searches that start with common question words and can help you to search for patterns that involve questions.

By being able to see what questions are leading to impressions and clicks to your site, you can better understand how your blog content is performing and what types of questions customers are asking at the beginning of the buying journey. This will give you some ideas for FAQs you can answer on your website.

Specific keyword filter

Code to copy: (keyword1|keyword2|keyword3)

If you are looking for queries that have one or more specific keywords, you can add them into parentheses using bars to separate them. This helps you to better understand how users are searching for your specific products or services (or if they’re searching for something different and you need to pivot your strategy).

Multiple keyword exclusions

Code to copy: ^(?!.*?(keyword1|keyword2))

Say you’re investigating a trend and want to leave a certain aspect of your business out of this search. You can do so using the keyword exclusion RegEx, which excludes keywords that are specified by you. So, for this one, be sure to select “Doesn’t match RegEx” from the dropdown when you’re enabling the filter.

For us personally, we always exclude “meatloaf” and “strawberry milk” from our search terms report thanks to a certain billboard

Keyword variation capturing

Code to copy: \bbase(word)?s?\b

When you replace “base” with the root of your keyword in the formula below, you can find keywords that are close to the one you are searching for. GSC will pull the root word, its plural, and common derivatives.

Long-tail keywords

Code to copy: ^(\w*\W){#,}

Have you ever wondered if long-tail keywords will benefit your website, or if the blog content you’ve written to target them is actually leading to clicks? Use this RegEx to see the types of keywords that people are using to come to your site.

In this example, you’d replace the # sign with the minimum number of words you are looking for in your query. So, for a query of 4 words or more, you’d replace the “#” with “4”.

Local searches

Code to copy: ^(near|in \b\w+\b)

There are various ways Google can interpret local intent from user queries, but one of the easiest ways users get local results is when they include the word “near” in their search.

And if you have a lot of locations you need to filter out, you can also replace the “\b\w+\b” portion with a specific location to tailor it to your needs.

Remember that you can also combine filters for a more complex analysis. Combine any of the patterns for a deeper investigation of keyword searches.

Intent: Transactional vs. Informational

Code to copy (transactional): (buy|price|order|cheap|discount|deal)

Code to copy (informational): (how to|guide|tips|learn|explain|best way)

Code to copy (comparison): (vs|versus|compare|comparison|alternative)

It’s vital to know what kinds of content are driving impressions and clicks on your site because this will show you what is having the most impact on your audience and where you might need to make some adjustments.

Using these RegEx queries will let you separate interactions spurred by the desire to buy, by the acquisition of helpful information, and by comparison searches, which could fall into either category.

Branded vs. Non-Branded Segmentation

Code to copy: (yourbrand|your brand name|brandname)

You may want to determine your non-branded search performance, which can give you a good indication of your real organic reach. To do so, you will filter out your branded keywords with this RegEx, using the “doesn’t match RegEx” filter for exclusion of the queries.

If you want to see only branded queries, do the same but apply “Matches RegEx.”

URL / Section Segmentation

Code to copy: /blog/

Code to copy: /product/

Code to copy: /author/

Another useful approach is using the above codes to filter page URLs, allowing you to see the traffic patterns related to blogs, products, and authors. It will give you insight into how your audience is interacting with your content in diverse ways.

Exclusion / Negative Matching

Code to copy: (yourbrand|\?s=|login|admin)

If you’re looking to remove junk queries, branded entries, and lower-quality pages from your reports, you can use this code along with the “Doesn’t match RegEx” indicator. This will give you better data as you examine your SEO metrics.

Find Post-Purchase Queries

Code to copy: b(clean|broken|wash off|repair|manual|fix|warranty)b

You would use this option to locate queries that are related to any product issues customers might be having, and then searching for information online. This could give you a heads up about any problems you might be unaware of, part defects, or ways products are being used incorrectly.

With this information in tow, you could further investigate with your team and make corrections, release helpful information to prevent the issue, or initiate a recall if need be.

AI- and LLM-Style Queries

Code to copy: ([^\s]*\s){9,}

AI platforms like ChatGPT, Gemini, Perplexity, and others often have longer, more conversational searches, with total words amounting to 10 or more per search in many cases.

This RegEx would help you to establish a baseline for what kinds of searches people are conducting on these platforms that have led to your site.

City and State Queries

Code to copy (cities): (?i)(new york|los angeles|chicago|houston|phoenix|dallas|san diego)

Code to copy (states): (?i)(california|texas|florida|new york|illinois|pennsylvania|ohio)

These RegEx codes are ideal for filtering information related to target cities and states so you can better see how you are performing.

Build Your Own RegEx Code

If you’re looking for options beyond those listed above, know that RegEx code can also be customized as long as you follow its style guidelines. By referencing an established structure, you will be able to create code that takes into account:

  • Character classes that distinguish between letters and digits
  • Assertions that look for matching patterns, including the beginnings and endings of lines and words
  • Groups and backreferences that indicate groups of expression characters
  • Quantifiers that indicate numbers of characters or expressions to match

Other Things to Check Out in Google Search Console

Using RegEx queries in GSC can help you to analyze search queries, identify trends, and better understand user intent. Don’t forget to experiment with different patterns and combinations.

Beyond RegEx queries, Google Search Console is useful for making conclusions about your audience and analyzing your website as a whole.

  • Insight into search performance – RegEx queries are used to help you conclude search behavior, but GSC as a whole can give you data on impressions, clicks, click-through rates, and beyond.
  • Indexing – GSC has a section that reports on the index status of your website, which highlights issues that prevent your pages from appearing in search results. These crawl results can help you solve crawl errors or detect issues with sitemaps.
  • 404s and other status code pages – Google Search Console shows the number of 404 pages on your website and allows you to review them. These pages are worth investigating and appropriately redirecting if you’re trying to optimize your website for search engines.
  • Security issues – You can use GSC to alert you of any security issues detected on your website, which allows you to take quick action to protect your site.
  • Internal and external links – Navigate to the links tab in Google Search Console to see the external and internal links pointing to each page on your website. For example, when you sort these pages in ascending order, you can see which pages might benefit from having more internal links.

Other Related Posts to Check Out

About the Author

Linton Lewis

Linton Lewis is our Content Editor where he contributes as an SEO writer for clients, while also overseeing all the editing for client writing. He has been at our agency for over 10 years and also holds an MFA in creative writing, as well as a BS in video production, both of which help our collective marketing efforts.