How to use RegEx in GSC
Click to hear an audio recording of this post

If you’re an SEO, then you would’ve surely come across the term “RegEx” one way or the other.

While Regex is not new to those who have been using Google Analytics, it’s fairly recent that Google integrated it into Google Search Console (GSC) too. However, its usability may vary in GSC. 

Have you got a chance to take it for a spin yet? 

If you’ve already tried using Regex in the search console, you know it’s not a domestic animal — it’s more of a wild beast. 

However, with practice and more resources being published by the day, you can master regex eventually. So here’s our attempt to add some value to the topic in discussion. 

In this guide, we’ll discuss what is Regex, its benefits, and how to use it in GSC (with examples and use cases).

Let’s get started.

What is Regex?

Regex is an abbreviation for the term “Regular Expressions”. It simplifies your search for complex queries and pages in GSC. 

In other words, Regex is a series of symbols and characters that, when applied, act as a directive to match specific patterns of text in search console filters. 

Earlier GSC filter had only three options:

  • Queries containing
  • Queries not containing
  • Exact query

So we could look at the only search phrases or expressions that would match the above filters. However, recently GSC has added another filter option called “Custom (regex)”. 

custom Regex

With Regex, you can customise your search filters with almost any type and combination of the queries. (phewww)

Let’s dig a little deeper into regular expressions before we understand their application in GSC. 

How Regular Expressions Work?

When you want group results to get extensive insights into specific search queries or webpage analytics, Regex are quite useful. 

Take a look at the image below. 

Regex example email


Let us simplify it for you.

For instance, the expression {x,y} matches the asked term between ‘x’ and ‘y’ times (x and y being numeric here). 

So when you apply {x,y} to any term, say “a”, like this — (a){2,4} — it’ll match all the terms that contain the character “a” between 2 to 4 times. Like this: aa, aaa, aaaa. 

Similarly, the $ symbol matches the end of a line. So if you apply the $ symbol to a term “xyz” like this — xyz$ — it would show you all the matching results like heyxyz, 123xyz, youxyz, etc. 

However, note that GSC recommends using the only expressions that are mentioned in RE2 Syntax — a software library for regular expressions.

RE2 Syntax 

Basically, the regular expressions act as wildcards for character strings when you use them in your search queries. And RE2 Syntax is a reference point for all the metacharacters that GSC supports. 

This library includes expressions as simple as a single-character or alphabet and as complex as: 

  • Grouping
  • Flags
  • Empty strings
  • Composites
  • Repetitions, etc.

And there are many more. Here, check the entire RE2 Syntax library

Feeling overwhelmed by whatever we discussed so far? 

We know, it’s complex enough to give a brain twist to any regular SEO or content marketer. So if you find things too techie to get a hang of it, you can always consult an expert technical SEO agency to make your life easier. 

Cheatsheet: Commonly Used Regular Expressions

RE2 Syntax is quite an extensive resource and may take time to refer to and digest. It’s great for Pros. 

Meanwhile, if you’re just starting out or exploring regex filters in GSC, you can start with the basic and most commonly used attributes. 

Here’s a cheatsheet

Regex Cheat Sheet

Thus, you can refer to such cheatsheets to understand the application of various regex attributes and how they impact your search in GSC.  

Now let’s understand how to locate the Custom (regex) filter option in GSC and then how to use it.

How to Use Regex in Google Search Console?

Rather than telling you how to use regex, let us show you instead. 

Here’s a step-by-step tutorial. 

Step 1. Log in to your GSC account

Step 2. Now go to the sidebar and click the Performance button and select Search results from the drop-down menu.


Step 3. Click New and select your search parameters. 


Step 4. Here you can select either Query or Page depending on your analysis requirements.


Step 5. Click the Filter or Compare option and you’ll see a drop-down menu. Select the Custom (regex) option from the menu.  


Step 6. Next, enter the regex attributes that you want to filter or compare your queries with. And hit the APPLY button.


This is how you navigate through the GSC to extract the collective data that you want to analyse. But it’ll make more sense once you’ll go through the example use cases in the next section. 

Regex in GSC: Example Use Cases

Here are some illustrations to help you understand custom regex’s application in the search console.  

Finding Queries with Search Intent

With the addition of regex in the search console, now you can find queries for single or multiple search intents.

Search intent — also known as user intent — is the main reason behind a searcher’s quest for information in search engines. You can enter specific terms like “what”, “why”, “how”, “where”, etc. in the Custom (regex) section to filter these queries in GSC. 

Alternatively, you can also form a cluster of such queries with regex attributes like this: ^(who|what|where|why|how)[” “] 


And once you enter these terms, you’ll be able to see all the relevant search terms your site appears for.

Here are the results for the above queries. 


These are the top questions that your site gets the most impressions and clicks for. 

Finding Queries that Start with a Specific Keyword

Now, let’s assume that you’re a SaaS company offering social media marketing tools. It’s a given that you’re promoting your tools through social platforms. 

Besides, you’re also using search-driven content marketing as a lead generation and customer acquisition channel. To improve your qualified search traffic through accurate keyword mapping, you want to check how your site is performing currently for your targeted keywords. 

Hence, you’d add the regex attribute ^ — matches the beginning of the line — to a keyword “social media”. It’ll look like this: ^social media. 

Now let’s apply the regex and check the results. 


As you can see it filters and shows the site’s performance for all the search queries that start with the target keyword “social media”. 


Thus, you can get the filtered report and analyse it accordingly. 

On the other hand, if you want to filter for the queries that end with the keyword “social media”, then apply the regex attribute $ at the end. Like this: social media$. (Don’t include the period punctuation in the end. Grammar thing!)

So it’ll show all the search terms that end with this keyword. 

Following us so far? 


Next up is how you can find search terms with a specific word count. 

Finding Queries with Specific Word Count

This hack is great at filtering the search performance of long-tail keywords for your site. 

Let’s say you want to find queries with 8 or more words in the search string. So you’d enter ([^” “]*\s){7,}? characters as Custom regex

Here’s how it would look. 


Once you apply this filter, you’d get the list of queries with 8 words or more. 


Thus, you can analyse the performance of specific long-tail keywords and improvise your content strategy as needed. 

Now based on the regex cheatsheet and the above examples, you can try out filtering some queries in your search console. 

With that, let’s understand the benefits of using regex. 

Advantages of Using Regex in GSC

Besides getting more flexibility in using GSC search filters, regex also brings in a few more benefits. 

Here they are.

Better Interpretation of Website Traffic

Agreed! GSC has always been serving the purpose of tracking website traffic in detail. So you’d know the queries that get the maximum impressions, clicks, and rankings for your site. Also, you’d have an idea about the pages that rank for those queries. 

But it’s still not the complete picture since you can only access the best data instead of all the data. 

However, with the custom regex update, now you can also access and analyse the information that used to get left out in pre-regex time. 

This would help you understand the search behaviour of your target audience even better and in detail. Accordingly, you can customise your site to give them a better user experience. 

Saves Time

Now you don’t have to search manually for individual search queries or phrases. 

If you learn to perform the regex filters correctly, you can search with multiple combinations with a single filter application. 

If working on GSC is a regular part of your work, learning the regex hacks would save a ton of your time. Moreover, it also helps you increase your efficiency and accuracy with exact desired results. 

Provides Insights into Spelling Errors

Not all search engine users would spell your brand name correctly. If you’re a global brand targeting customers in multiple countries, you’d need to account for the common spelling errors of users in non-English speaking countries.  

Let alone non-English speaking users, native English-speakers are also prone to typos. 

Earlier we had to cater for such errors by integrating them into page headers and content. But nowadays, search engines have become much smarter. 

Let’s make an intentional spelling error for a famous brand and search in Google. 


We searched “telsa” but Google knows we are referring to Mr. Musk 😉

Thus, you can make a regex cluster of your brand’s commonly misspelt names and search in GSC. 

This would give you a better idea of the hidden clicks and impressions that terms with correct brand spelling may miss out on. 

Challenges of Using Regex 

The Custom regex update in GSC is relatively new. So it’s not all hunky-dory while using them. There are a few challenges that persist which we hope Google will address as they would keep getting more user feedback. 

Here are a few of them. 

Trial and Error

Mostly we learn any new technology by practising, making errors, and correcting them. 

Similarly, using Custom regex filters may take time and practice. It might also test your patience at times. 

Sometimes you may forget the right place to add regex. Or may end up using the wrong attribute for the intended filter. For instance, placing $ before the keyword instead of adding it after the keyword. 

However, as discussed earlier, once you crack the code, you’ll save a lot of time for yourself. 

So keep at it. Moreover, if you’re using external SEO services, their technical SEOs can help you with their consultations. 

Case Sensitivity

Being an SEO, you’re not expected to be grammatically correct all the time as writers. So you may use upper or lower case as it pleases you. 

However, GSC performance reports are case-sensitive. So if you enter “SOCIAL”, it’ll only show you the searches and clicks that happened with “SOCIAL”. 

Nonetheless, there’s a solution: 

Use the (?!) regex before the word. Like this: (?!)SOCIAL and then apply the filter. 

It’ll show you all the case possibilities for the term such as SOCIAL, Social, social, etc. 

Requires Technical Upgradation for SEOs

It’s often heard that SEOs should have a little know-how of coding. With updates like Custom regex and Core Web Vitals, Google also seems to indicate that it’s time for SEOs to upgrade their knowledge about technical terrains of search. 

That said, mastering the usage of regex in GSC would certainly be challenging even for Technical SEOs. However, the perks that come with it are totally worth the effort. 

Final Thoughts

And thus, we made it till the conclusion. 

So if you could follow us till here, well done!

Although we tried to put things across as simply as we could with tutorials and examples, it’s okay if you couldn’t get it in the first read. Learn more about using regex in GSC and more importantly, practice what you read and figure out your way to mastering the regex. 


Enter Your Website & get an instant SEO Report for FREE