I’m trying to block specific competitor email domains across all our 150+ forms adding domains to each forms is very big task. So I have been exploring the CRM Property Validation approach (Settings → Data Management → Properties → Email → Rules → Custom regex).
Background:
Our forms are on the V4 forms engine, so the Forms API PATCH endpoint returns a 403 BANNED error for write operations. HubSpot support confirmed there is no supported bulk update path for configuration.blockedEmailDomains on V4 forms. The suggested workaround was to use a custom regex rule on the Contact Email property.
The problem:
I’m struggling to write a regex that HubSpot’s engine accepts. My goal is simple — block emails from example1.com and example2.com, while allowing all other valid email addresses.
Here’s what I’ve tried so far:
1. ^(?!.*@(example1\.com|example2\.com)).+$
→ Error: “The regex is not valid”
2. ^[\w.-]+@(?!example1\.com|example2\.com)[\w.-]+\.[a-zA-Z]{2,}$
→ Error: “The regex is not valid”
3. ^(?!example1\.com|example2\.com).*$
→ No error but blocked ALL emails including valid ones
4. ^(?:example1\.com|example2\.com)$
→ Only allowed example1.com and example2.com, blocked everything else
I also tried the “Generate with AI” feature in the regex field. It worked for blocking a single domain (generated ^(?:example\.com)$ which makes me think HubSpot’s regex engine matches against the domain part only, not the full email). But when asked to block specific domains while allowing everything else, the AI generated an incorrect regex that blocked all emails.
My questions:
1. Does HubSpot’s regex engine match against the full email address or just the domain part?
2. Is negative lookahead (?!) supported in HubSpot’s regex engine?
3. Can anyone share a working regex that blocks specific domains while allowing all others?
Any help from the community would be greatly appreciated!
Welcome to the Community! Thanks for the detailed breakdown of what you’ve already tried. To start here I’d like to include our guide on the matter and a community article that may point you in the right direction :
Regarding your question #2, the docs say the regex rule uses RE2 syntaxt and RE2 does not support lookahead/lookbehind: Accounts Dashboard | HubSpot
Have you tried EMAIL_BLOCKED_DOMAINS?
For this use case I would be careful about making Contact Email regex the enforcement boundary, especially if you need the rule to behave like “allow every valid email except these domains.” If the property validation layer is using RE2, then negative lookahead/lookbehind patterns will not be available, and the rule quickly becomes hard to reason about.
If `EMAIL_BLOCKED_DOMAINS` works for your portal and can be applied where you need it, that is probably the cleanest HubSpot-native path. The tricky part, as you called out, is operational coverage across many V4 forms when there is no supported bulk update path for `configuration.blockedEmailDomains`.
The pattern I would consider is moving the domain blocklist one hop before HubSpot:
1. Public forms submit to a server-side handler you control.
2. The handler checks the submitted email domain against a central blocklist.
3. Allowed submissions forward into a hidden HubSpot destination form.
4. Blocked or uncertain submissions go to quarantine instead of becoming contacts.
That gives you one domain list to maintain across forms and avoids depending on a regex dialect for an “everything except X/Y” rule. I would still keep a quarantine/release path rather than silently dropping every blocked-domain submission, because domain rules can become policy decisions rather than pure spam decisions.
I’m working on a small HubSpot Forms-specific tool around this kind of pre-HubSpot filtering. Basic assisted setup uses forms scope only, not contacts read/write. Happy to share the checklist if useful.