Tips Google Search Console: Regular Expressions (Regex)

Tutorial
March 20, 2023
3 min
Google Search Console #Regex
Key points

To enhance the analysis of your natural referencing (SEO) performance in Google Search Console, you can use filters.

There are several types of these filters. First, in Performance > Search Results, you can choose the type of search (Web, Images, Videos, News). You can also filter by date. Finally, you can click on “+ new” to access filters for queries, pages, countries, devices, or appearance in search results. Filtering options are already provided in all these categories. However, you can customize your filtering for queries or pages using regular expressions (regex).

1 - What is a regular expression (Regex)?

Regular expressions, or Regex, can simply be defined as a pattern recognition tool. In other words, regex captures precise information and relays it using its own syntax. These regular expressions will detect and reveal specific expressions that you wish to retrieve through a command.

In Google Search Console, regex enables you to filter results for the most frequent queries and the most popular pages. More concretely, for example, I could view and analyze the number of impressions and clicks solely for queries containing a number. I could also identify URLs that are not secure (http, not https) appearing in Google search results and the queries they appear for.

2 - How to use regular expressions (regex) in Search Console?

Using regular expressions (regex) in Google Search Console is very simple. To do this:

  • Step 1: Log in to Search Console
  • Step 2: Go to Search Results under the “Performance” tab
  • Step 3: Click on “+ new” (next to Date)
  • Step 4: Select either “queries” or “pages”
  • Step 5: Choose “custom (regular expression)” instead of “queries containing” or “URLs containing”
Regular expression (regex) filtering system for queries in Google Search Console
Regular expression (regex) filtering system for pages / URLs in Google Search Console

You can now enter your regular expression. Additionally, two options are available to you. You can choose the filter that corresponds to the regular expression or the opposite, which does not match the regular expression. In the latter case, for example, if you had entered a regex to filter queries that include a number, you would see all queries except those containing a number.

3 - Different types of regular expression filters

Regular expressions follow a specific syntax that is important to understand. In this section, we will briefly introduce you to some syntax rules before presenting concrete examples. Here is a non-exhaustive list of various characters used in regular expressions along with their descriptions:

  • ^ : Start of the string character that limits matches to the beginning (For example: “^who” will match expressions starting with “who ...”)
  • $ : End of the string character that limits matches to the end (For example: “^?” will match expressions ending with a question mark)
  • | : Represents the word “or,” meaning it matches the expression before OR after the vertical bar (For example: “Digidop | Digi” will match both “Digidop” and “Digi”)
  • [ ] : Matches any of the characters included within the brackets (For example: “Di[gmb]idop” will match “Digidop,” “Dimidop,” or “Dibidop”)
  • ( ) : Represents a group of characters
  • - : Character range within [ ]

[a-z] : Lowercase letters from a to z

[A-Z] : Uppercase letters from A to Z

[0-9] : Numbers from 0 to 9

Of course, you can make combinations to select a specific range. For example, [d-g1] for lowercase letters from d to g or the number 1

  • . : Matches any character (For example: “Dig.dop” matches “Digidop,” “Digodop,” or even “Digjdop”)
  • * : Matches the preceding character 0 or more times
  • + : Matches the preceding character 1 or more times
  • ? : Matches the preceding character 0 or 1 time
  • {min,max} : Matches the number of words between minimum and maximum values
  • {min,} : Matches the number of words between a minimum value and infinity
  • {,max} : Matches the number of words between 0 and maximum value
  • {number} : Matches the exact number of words specified in the brackets
  • \w : Matches all characters from a to z, A to Z, and 0 to 9 ([a-zA-Z0-9_])
  • \d : Matches a digit ([0-9])
  • \D : Does not match a digit (opposite of \d)
  • \s : Matches a whitespace (For example: “digi\sdop” matches “digi dop”)
  • \S : Does not match a whitespace

4 - Examples of regular expressions used in Search Console

This language may seem a bit complicated, but don’t worry; in this section, we will provide you with useful regex examples.

^(who|when|how|where|why|what)[" "] : This regular expression sorts your queries based on questions. In other words, it will retrieve all queries for which you are ranked that start with who/when/how, etc. Very useful when you want to know the questions users are asking.

^(vs|price|review|purchase|buy|order|promo|promos|comparison|best|better)[” “] : This expression is a variation of the previous one but is more useful for e-commerce. It sorts queries in the Search Console based on words like price/best, etc.

^(winter|spring|summer|autumn)[” “] : A final example variant of the previous regex. Here, it is used to filter queries based on seasonality. Customize this expression to your liking by changing the keywords.

([^” “]*\s){5,}? : This regex will show you all queries containing 6 words or more. You can of course change the number to customize your filtering. Useful for identifying long-tail keywords.

(\w+\s){5,}\w+ : A variation of the previous expression that is quite similar.

^http: This regular expression will be useful (to be included in the “page” type) to check the URLs of your site that are not secure.

web(flow)? : Lists queries containing the word Web and optionally Webflow.

^web(flow)?(design)?$ : Lists queries containing the word Web and either Webflow or Webdesign.

\d : Lists keywords/queries containing a digit.

These are just a few examples among many, but here is an illustration of what you can achieve. For more information, you can directly check the Google Search Performance report or refer to the Re2 syntax.

On the other hand, if you need help with building your SEO strategy, Digidop is here for you!

Thibaut Legrand
Thibaut Legrand
Technical Solutions Architect & Webflow Expert

Suggested articles

Webflow Localization, Credial's Use Case
Documentation
Webflow

Webflow Localization: Practical Guide & Credial's Use Case

Webflow Localization: Practical Guide & Credial's Use Case
Visuel showcasing digidop.fr switching to digidop.com
News
Digidop

Digidop.fr is now Digidop.com

Digidop.fr is now Digidop.com
Photo of the Digidop team with the Digidop Logo 2024
News
Digidop

A Look Back at an Exceptional 2024 and Vision 2025

A Look Back at an Exceptional 2024 and Vision 2025

Want to turn your website into your most valuable asset?

Contact us today