SyntaxFix
Write A Post
Hire A Developer
Questions
Your primary question has been answered above. I just wanted to point out that the regex you're using has a bug. It will also succeed on foo-domain.com which is not a subdomain of domain.com
foo-domain.com
domain.com
What you really want is this:
/(^|\.)domain\.com$/