Regex to Exclude Multiple Words

For Google Analytics, I wanted to create some chainable filters to deal with a set of subdomains that can occur on alpha, beta, and production, etc. So I needed to find a way to say “Give me all of the production subdomains, and none of the alpha/beta variants, or preprod.”

Here are the sample URLs that I want to filter out the alpha/beta/preprod from:

Here is the resultant regex:


And here is what Rubular looks like:
Rubular Multi Word Exclude URL Regex

Big shout out to, an awesome place to test out regex!