Compiled List Of Regex For SEO

I asked on Twitter for everyone's favorite regex experessions for SEO.

I received a few responses. I am adding them here and will update as I receive more.

Pedro Dias

Matches [non slash] + [non slash w parameters] and [slash] + [slash w parameters] and at the end or a URL. Useful for redirecting legacy stuff


David Sottimano

Match single slash


Match first folder without trailing slash


Match first folder with trailing slash


Match 2nd folder without trailing slash


Match 2nd folder with trailing slash


Natzir Turrado

Match 1 country-coded folder, 1 word folder, 1 digit folder and 1 folder without trailing slash that doesn't start with "contact-"


e.g. match "/uk/london/123/bond-street-store" 
but not "/uk/london/123/contact-bond-street-store"

If you have one that you think would be good to add, ping me on Twitter. There is also a library here that is part of a tool called regex101. This is my goto tool for debugging regex.