Professional Documents
Culture Documents
Regular Expressions are used in several areas during Search Engine Optimization. The
following are a couple of major real world use cases:
We will look into these real world uses cases in the following slides.
a) Using Regular Expressions on Google Analytics.
One of the most common uses of Regex for SEO is in Google Analytics, where
Regular Expressions can be used to set up filters so that you only see the
data you want to see.
In this sense, the expression is used to exclude results, rather than to
generate a set of inclusive search results. For example, if you want to exclude
data from IP addresses on your local area network, you might filter out
192.168.*.* to remove the full range from 192.168.0.0 to 192.168.255.255.
For Universal Analytics, Regular Expressions can also be used to create
custom dimensions, create custom groupings and ‘or’ & ‘and’ expressions.
b) Using Regular Expressions in Google Search Console.
One of the most interesting use of Regex for SEO is to filter Google Search
Console Performance report.
In Google Search Console, you can use Regular Expressions to filter query or
pages that match or doesn’t match the Regex patterns that you define. This is
pretty powerful to dig into your queries to identify questions user may ask, find
long tail queries or to find potentially duplicate URLs.
Examples you can use in Search Console can be filtering for queries containing
a specific brand and the variations users could type, such as Facebook:
.*facebook.*|face*book.*|fb.*|fbook.*|f*book.*
Filter out users finding your website through “commercial” intent terms:
.*(best|top|alternate|alternative|vs|versus|review*).*
Precautions while using Regular
Expressions in SEO
A poorly written Regex can quite easily filter out most or all of your data by
including an unrestricted wildcard match. The good news is that in many SEO
cases, the filter is only applied to your data at the reporting stage, and by editing
or deleting your Regex, you can restore full visibility to your data.
You can also test Regular Expressions on a number of online testing tools, in
order to see if they achieve the intended outcome – allowing you to ‘sandbox’
your regex expressions before you let them loose across your entire data set.
Thanks