As if Google would update our beloved Google Search Console without telling us…
Nah, they wouldn’t do that, would they?
If you aren’t on Google’s email hotlist, The Big G released regex to level-up our query search game.
Let me take you through everything there is around how regex works on Google Search Console…
- But first, what is regex?
- How to use regex within Google Search Console & where to find it
- Common regular expressions
- Example regex search console queries
- Check out the comparison filter, too!
- Benefits of regex in GSC
- Negatives of regex in search console
- Key takeaways on how regex works on Google Search Console
But first, what is regex?
Regex stands for “regular expressions” and allows you to perform more complex query and page searches in Google Search Console than before.
It’s designed so you can delve deeper into performance reports to get more value from the data that traffic to your site generates.
Think of it as using certain parameters to search for results in strings.
Previously, search queries limited you to three options within “query” and “page” options:
- Queries containing
- Queries not containing
- Exact query
And now, we’re blessed with the “Custom (regex)” option at the bottom:
Pre-regex, we were very limited in what search expressions and phrases we could look for.
With the regular expression filter now in full-throttle mode, the world is yours using RE2 syntax.
What is RE2 syntax and how does it work with regex?
RE2 is a deterministic finite automaton (DFA)-based software library regular expressions.
Essentially, when you use a regular expression in your search query, that expression is a wildcard for character strings. The expression can either be single-character or take more complex forms, such as:
- Possessive repetitions
- Empty strings
- Escape sequences
- Character class elements
- Named character classes as character class elements
- Perl character classes (all ASCII-only)
- ASCII character classes
- Unicode character class names
- Vim character classes
- Magic (not Harry Potter-related!)
Picked yourself up off the floor yet?
If you’re a regular SEO or a content strategist like me, some of those RE2 groups make barely any sense, but those more coding-based will be licking your lips.
For this article, I’ll stick to more simple search strings, but you can check out the full RE2 syntax if you like.
How to use regex within Google Search Console & where to find it
Locating regex is really simple and is only slightly different to how you would’ve run query and page searches before:
1. Log in to Google Search Console: https://search.google.com/search-console/about
2. Hit the “Performance” link in the sidebar:
3. Set your search type parameters and select “NEW”
4. Then select either “Query…” or “Page…”
5. Click either “FILTER” or “COMPARE” and then “Custom (regex)”
6. Enter your regular expression & hit “APPLY”
Common regular expressions
I’ll walk you through some examples further below, but for now, check out some of these more simple common regular expressions:
|||Matches all characters inside ||“b[ae]n” will match “ban” and “ben”|
||||Represents the “or” function||“1|2” returns anything that contains “1” or “2”, no matter the length|
|*||Matches the preceding expression at least zero times, while keeping the consequent expression||“do*g” will return “dg”, “dog”, “doog”, “dooog”, etc.|
|+||As “*” but returns at least one match||“do+g” will return “dog”, “doog”, etc, but not “dg”|
|.||Will match any single character||“.at” will return “bat”, “cat”, “mat” but no more than 1 replacement character in this example, such as “flat”|
|^||Will return the expression at the start of the string||“^seo” will return “seo tips”, “seo guide”, but not “tips on seo” or “guide on seo”|
|$||Will return the expression at the end of the string||“seo$” will return “tips on seo”, “guide on seo”, but not “seo tips” or “seo guide”|
|\s||Acts as a whitespace wildcard||“\sseo” will return “ seo” (note the whitespace at the beginning) of the result|
|\S||In contrast to “\s”, acts as a non-whitespace wildcard||“\Sseo” will return “seo” but ignoring any whitespace in a “ seo” string|
|\d||Matches any number from 0 (zero) to 9||“202\d” will return “2020”, “2021”, “2022”, up to “2029”|
|\D||In contrast to “\d”, will match any non-numeral (characters and symbols)||“202\D” will return “202a”, “202b”, “202%”, “202$” etc., but not “2020”|
Example regex search console queries
Let’s keep it simple and look at some examples so you can take them away and apply them to your search queries.
1. Simple character example
So, if we wanted to look for all search queries that contain the letter “a”, we throw that into the custom regex field:
Our filtered results now all contain the letter “a”:
But, we could do this before using the “queries containing” search option.
Also, searching for a single character alone isn’t that helpful when your site is ranking for lots of longtail keywords.
Regex allows you to use RE2 characters, such as the pipe “|” to specify “OR”.
If we wanted to filter for search queries that contain either the single characters “a” or “b”:
With regex support in Google Search Console, you would only have been able to do this one at a time… which proved to be frustrating, to say the least.
Hopefully, you can see how wild you can go with regular expressions. Just be aware of the default partial match rule.
2. Partial match as default (using a “flags” example)
Partial match means that the regular expression can appear anywhere in the search string, which you’ll notice from the examples above.
The good news is that you can override this by using two different RE2 flags:
- ^: Matches at the beginning
- $: Matches at the end
Let’s get more inventive and look for “seo” search queries at the beginning.
Without using “^”, you can see that “seo” can show up anywhere in the string:
With using “^”, all strings have “seo” at the beginning:
… as you can see from the results:
On the flip side, “$” will return the string of “seo” at the end of search queries:
… with the results as follows:
3. Searching for specific user intent
While the argument of moz vs semrush vs ahrefs seems never ending, all SEO keyword tools can give you an insight into keyword optimization.
But, with the regex and Google Sales Console combination, we can now see what queries people are using with such intent straight in GSC.
Check out this example…
The question search intent is amazing for bloggers:
And we can throw this straight into the regex custom filter:
Note that we use the following wildcards:
- ^: So our question words are at the beginning of the string results
- (): Since we’re using more than one wildcard, we need these
- |: To specify the “OR” function
This is awesome for looking for emotional trigger phrases.
Check out the comparison filter, too!
Get clever with the comparison filter by comparing different search strings.
For instance, checking the traffic for these two wildcard strings:
Shows us more clicks and impressions for queries with “seo” at the beginning than it at the end:
Apply this functionality with a combination of different wildcards for maximum effect. For instance, these are good comparison search strings to compare for product/service reviews:
Benefits of regex in GSC
It’s clear how wild you can get with regex support now in place with GSC, but there are some clear knock-on effects we can all bear fruit from:
- Time savings
- Further insights than ever, such as misspellings
- Complete understanding of search data to further business and sales
- No need to link to Google Analytics anymore
1. Massive time savings through Google Search Console
The hassle of manually needing to go into each query or page to search for separate phrases each time has always been frustrating for me.
I don’t know about you, but my trusty laptop still finds Google Search Console to be quite sluggish.
Sure, exporting is always an option, but that still always involved manual intervention.
Now, we can get the EXACT results we want in one fell swoop, greatly increasing efficiencies through saving time.
2. Insight into misspellings
Gone are the days when we had to cater for users’ misspellings to try and target them for SEO and integrate them into our headers and content.
Take Googling “Nike store” incorrectly, for example: The SERPs are for the correct spelling:
But, did you know you can use the GSC and regex combination to see exactly which pages on your site are getting the misspellings?
While you could’ve done this before, you’d have to search for the specific misspelled word one at a time. Now, you can use multiple wildcards in combination with the correct spelling to do further analysis.
It also gives you an idea of relevant search intent.
For example, this could give you insightful knowledge to run a specific ad campaign for pages that you wouldn’t have before.
The knock-on effect of this could be increased leads, conversion, sales and customers!
For this, consider using the correct and incorrect spellings with the pipe (|) symbol.
3. Full understanding of your traffic
There’s no doubt how useful GSC is for understanding:
- What queries give your site the most clicks, impressions and ranking
- Which pages rank for those queries
- (and more)..
BUT, we’ve always only felt like we’re partially in control of understanding the entire picture. We’ve only been able to really search for the best data, rather than all data.
Now, we can hack and slash in much more detail, picking out some quick wins (from the above examples) that either needed more searching than before or were just flat-out missed.
Again, being able to see everything more clearly is going to lead to tailoring your sites for your customers much better.
This has always been important in content analysis, but you can now do even more!
If we can pass on those deliverables to our customers based on what they actually want rather than what we think they want, we’re onto a real winner!
Up until now, we’ve had to link our GA and GSC accounts to use regex.
While some of you may be frustrated with learning a “new” way of filtering for regex strings, it’s definitely a much more improved and simple method.
Negatives of regex in search console
1. Hurdles still exist
You can’t deny that GSC has always been useful, and while Google has let us take another bite of the carrot, it’s still somewhat dangling in front of us.
SEOs are having to further expand their skill set further into coding, but some will argue that SEOs should have an element of coding knowledge anyway.
This is even more true with the Core Web Vitals update, so be prepared to have to smash over those hurdles, Olympian-style!
Even so, I’m sure it’ll be worth the effort, especially if you can deliver those increased conversion rates.
2. Takes some testing
You’re not going to nail your expected regex filter the first time, so don’t expect to!
For example, a common mistake is to put the $ expression at the beginning of the string instead of the end:
- Correct: seo$
- Incorrect: $seo
With this in mind, expect a resource issue at the beginning and go easy on your SEO…
…but feel free to crack the whip after 2 minutes 🙂
A way to mitigate the downtime is to check out the full RE2 syntax and see how you can apply it to your businesses.
3. Case sensitivity as default
SEOs aren’t natural-born content writers, nor are we English language majors, so the default matching being case-sensitive is frustrating.
The way around this is to use “?!” at the beginning of the search string:
The above will return:
Perhaps Google will provide us with an option to switch case sensitivity off in the future?
4. Invalid syntax doesn’t return matches
Instead of displaying the frustrating “no data”, swapping this out for something like “Invalid regular expression syntax” would help us much better.
It kind of feels like releasing a video game/movie that doesn’t appear to be finished (I’m looking at you, Cyberpunk 2077 & Wonder Woman 1984).
Key takeaways on how regex works on Google Search Console
Although we’ve always been able to use regex via Google Analytics, having it supported in Google Search Console is most definitely welcome.
For those of you with prior knowledge of RE2, you’ll be off to a flying start.
But, for those SEOs out there that are still floundering, check out all that the RE2 syntax has to offer and apply some of the common expressions I’ve mentioned above to your business, queries and pages.
I can’t hold back on my frustration for some quick fixes, but that doesn’t stop us from drilling down into the data like we should’ve always been able to.