Skip to content

Instantly share code, notes, and snippets.

@mikeciffone
Created April 16, 2021 13:15
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikeciffone/b6bad66672075386b4b267021727ef45 to your computer and use it in GitHub Desktop.
Save mikeciffone/b6bad66672075386b4b267021727ef45 to your computer and use it in GitHub Desktop.
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