15 Advanced Regex: Mastering Google Search Console
In the labyrinth of data that is Google Search Console, we’ve been on a treasure hunt. Piece by piece, we’ve unearthed the secrets to optimizing our website’s visibility and decoding the stories behind clicks and queries.
With each post, we’ve delved deeper, moving from the realm of basic search terms to the more enigmatic world of regular expressions (regex) — our powerful ally in slicing through data clutter.
But our journey is far from over. It’s time to arm ourselves with even more complex regex amulets that can reveal the hidden chambers of our website’s performance and illuminate the path to unmatched SEO success.
All URLs under a specific directory
This regex will match all URLs that start with
/directory-name/. This is particularly useful if you’ve organized your content into folders and want to see how all content in a particular folder is performing.
URLs that end with a specific file extension
extension with the desired file type (e.g.,
jpg). This regex is helpful if you want to see how specific file types are performing, like how often PDFs on your site are accessed.
URLs that contain a number
This pattern matches any URL that contains a number. It can be useful if you have a pattern of URLs that contain numerical identifiers or dates.
URLs excluding certain parameters
exclude-parameter with the parameter you wish to exclude. This is helpful if you have certain URL parameters that you do not want to see in your results, such as tracking parameters.
URLs that contain certain keywords
This pattern matches any URL that contains any of the keywords you specify. Replace
keyword3 with your desired keywords. This can help you quickly see how pages about certain topics are performing.
URLs that have either www or non-www but not both
This will capture both
http://www.example.com/ but not URLs that might accidentally have patterns like
URLs containing any of a list of specific parameters
This is useful if you want to capture URLs that contain specific URL parameters.
URLs that start with a language or country code
This will match URLs that are organized by language or country code, such as
Exclude URLs with certain file extensions
This regex will exclude all URLs ending with
Capture specific patterns in subdirectories
This is useful if you’re interested in performance from specific subdirectories under a main directory.
URLs that contain a date pattern
This can be useful for blogs or news sites that structure their URLs with date patterns.
Match URLs but exclude certain paths
This will match URLs that start with
/path/to/match/ but exclude URLs that have the subpath
URLs that contain certain patterns, but only at the end
This regex matches URLs ending with either
keyword2, potentially followed by a single trailing slash.
Match specific file types under specific directories
This captures specific file types like images under a specified directory.
Complex parameter matching
Matches URLs with very specific parameter-value pairs.
Google Search Console’s regex implementation might differ slightly from the standard. It’s always a good idea to test your regex patterns to ensure they match the desired URLs. Additionally, as you become more familiar with the specific structure of your website’s URLs and the queries you’re interested in, you can further customize these regex patterns to better suit your needs.