Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Useful Google Search Console Regex (Re2)
#################################################################################
# Running List as of 04/16/2021
# Uses Re2 so PCRE-style backreferences and look-around assertions are not supported
# -------------------------------------------------------------------------------
# Refrence:
# https://github.com/google/re2/blob/master/doc/syntax.txt
# https://search.google.com/search-console
##################################################################################
# Matches URL slug
^[foo]+(?:-[bar]+)*$
# All urls within /page
(http|https):\/\/www.example.com\/page\/.*
# All urls between a certain slug and ending
(http|https):\/\/www.example.com\/slug\/[^\/]+\/page
# Matches all queries containing a specific term (all work)
\b(\w*foo\w*)\b
\b(\w*foo\sbar\w*)\b
^hello\sworld$
# Matches all queries containing "blue shoe" or "blue shoes"
(\W|^)blue\s{0,3}shoe(s){0,1}(\W|$) //works
# Matches all queries that contain "Ciffone" or "Ciffone Digital"
^.*(ciffone|ciffone digital).*$
# Match Word or Phrase in a List
(?i)(\W|^)(foo|bar|foo\sbar)(\W|$)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment