Proper Regex to Filter Out Subdomain

Not exactly a PHP question, but I go to this thread for my Regex confusion from time to time.

I am using Google Analytics filters (for a subdomain profile) to filter out my primary domain. One filter I have with Regex exclude is this:

^www\.domain\.com$

I think the subdomain is still picking up domain.com, so if I add another filter, would I just do… domain\.com$

Is that all it takes?

Cheers!
Ryan

No, domain\.com$ matches all subdomains of domain.com. If you want to match only “domain.com” (and not any of it’s subdomains) you should use ^domain\.com$ :slight_smile: