Blog site

How to Use Regex Filters in Google Search Console to Optimize Site Performance

Regular expressions (regex) are a pattern-matching syntax that you can use to search for complex strings. Google Search Console (GSC) provides the ability to use regular expressions to filter and sort search queries and page performance data.

You can optimize your site’s performance by analyzing search data using specially designed regex filters.


Benefits of using Regex in Google Search Console

Regex allows you to read and analyze data without relying on the Google Analytics web application or other external tools. Here are the many ways you can use regex to optimize site performance:

  • Create queries to filter out pages with the lowest CTRs and figure out how to optimize them for better performance.
  • Get insights into the type of queries triggering your pages, such as how-to questions, misspelled words, and more. Optimize your site to meet these queries.
  • Depending on the intent of the query, companies can fill knowledge and information gaps about their products and services.
  • Get as specific as you want with regex targeting specific products or pages. For example, understanding the data and metrics of a limited-edition offer over a given time.
  • Instant results based on previous GSC data, no need to set up filters and wait for goals.
  • Compare and contrast personalized results for different data sets to gain additional insight into your site’s search performance.

Free Resources to Learn Regex

Regex is easy to learn because its syntax is quite simple. You can use the following resources to fully understand the syntax and its application in various programming languages:

  • RegexOne: An interactive regular expression learning course made easy for non-technical users.
  • A GitHub repository, Learn Regex the Easy Way: full-text regex course with examples, tests, and translations available in different languages.
  • Our own article, The Beginner’s Guide to Regular Expressions with Python: A Quick Guide to Python’s Supported Regex Syntax.
  • Regex for SEO from RegexLearn: an interactive open source platform to learn regex for SEO.

Follow the hashtag #performanceregex on Twitter to learn more about new ideas and regex queries for GSC.

How to Use Regex Filters in Google Search Console

Here is a step-by-step guide on how to use regex filters in Google Search Console:

Step 1: Log in to Google Search Console

You need admin access to your website’s GSC account to use regex once you’ve logged in.

Step 2: Click on Performance in the left menu

Select the search property you want to display from the drop-down menu on the left side. Then click on Performance to display search query data that you can manipulate using regex.

Step 3: Click +New in the filter options

Click on +New in the filters menu at the top of the page to reveal Query and Page options.

Step 4: Click Query Where Page to access Custom (regex)

When you click on the +New filter, you get four options. You can choose either the Query or the Page ability to use regex in GSC.

Click on the Queries containing drop-down menu to access Custom (regex) in the dialog box with the Filter and Compare tabs.

Step 5: Enter the Regex in the Custom (regex) Field

Once you click on Custom (regex), you will get an empty field to enter your regex. Enter your regex here and click Apply to see personalized results.

You can either match results containing the regex string or filter them using the Does not match regular expression option.

Google Search Console has a 4096 character limit for regex strings.

Step 6: Export Regex Data

Click on the Export option in the upper right corner to export the data to a spreadsheet or CSV file for further manipulation.

4 Regex examples you can use to get the most out of Search Console data

Regex queries will only work if your website has considerable search impressions to glean data from. Here are some common regular expressions used to manipulate website data.

1. Regex for Questions in Search Queries

^who|^what|^where|^why|^when|^how|^will|^is|^was|^are|^do|^did|^does|^can|^if

This regex string displays all search queries related to the questions your website showed up for. Add more question modifiers like should, want, don’t, isn’t, etc. to the query to show more results.

Use the resulting data to create short articles for Google’s snippets section, long-form blog posts answering queries with sparse results, understand user intent when clicking on your website, and find the inspiration for content ideas.

Sort by number of clicks to find posts with low click-through rates to improve the content you deliver on those topics.

2. Regex to find long-tail keywords

(w*W){5,}

This regex string brings up search queries with six or more words involving an appropriate phrase or question.

This regex string brings up search queries with six or more words involving an appropriate phrase or question. You can replace the number 5 with any other number to shorten or lengthen the query string to find more long-tail keywords.

Use long tail keywords with high volumes like H2 in blog posts to improve your website search ranking.

3. Regex to Match Misspelled Keywords

Example: Ell?i?(s|z)?(a|e)?(b|p)?eth?

This example query matches all misspellings and variations of the name Elizabeth. You can create similar regular expressions to find brand-related information, such as data on common misspellings of brand names, keyword variations, and more.

A ? after a letter indicates that the letter may or may not appear in the string. Use the function or | to include all possible combinations for commonly substituted vowels or consonants. To add (?-I) to your query if you want case sensitive matches.

Prefix ^ to your query to match keywords starting with your string, or add $ to match keywords that end with your regex string.

Use this helpful test tool from regex101.com to check if your regex query is working as expected.

4. Regex to parse subdirectory lookup data

Example: example.com/.*/brand1

This regular expression example shows the performance of all URLs in a particular subdirectory, as well as data about the search queries that triggered those results.

Use this query format in conjunction with your URL structure to find data on product sets, product categories, top-selling brands, and more.

Copy the URL for useful regex queries and save it to run again with one click.

Optimize your website performance with Regex

You can use regex in GSC to analyze query-related data or page performance metrics to improve your website’s search performance. Once you’ve mastered the art of using regex, exploit it for other purposes such as software testing, HTML form validation, and more.