Quick tipHidden trickSmart CRMData Hub

Validate text properties with regex rules in HubSpot

Basic rules handle length and character types. Regex handles formats like IDs, codes and postcodes.

Subscription
Regex custom rules need Professional or Enterprise
Permissions
Edit property settings
Time
5 min · Advanced
Last verified

Short answer

In a text property's Rules, choose Validate using custom rules to enter a regular expression and the message users see when a value does not match. Generate with AI can draft the regex. Basic rules cover unique values, minimum and maximum length, and allowed characters. HubSpot's KB examples include ^\d{5}$ for five-digit zip codes. Custom regex rules need Professional or Enterprise.

1. Basic rules

The Job Title property in my demo portal, Rules section.

Job Title property rules with Validate using basic rules selected and options for unique values and character limits
Basic or custom (1), and the basic rules (2).

2. Custom rules

Selecting custom rules shows the regex field and message fields. I switched it to see the options and discarded the change.

Custom rules with Custom rule regex field, Generate with AI link and Invalid value message field
Custom rules (1), the regex field (2), and Generate with AI (3).

3. Before you add a rule

  • Rules apply when creating, editing and importing. Existing values that break the rule show as invalid on the record.
  • Test the pattern on real values first. A wrong pattern blocks good data at import.
  • For phone numbers, use the built-in rule in phone number validation.

Sources

New field notes by email

One email when a new article publishes.

Still stuck?

If this did not fix it, the problem is probably specific to your setup. Book a call and we will look at it together.

Book a call with Sam