Patterns are used to validate incoming leads by enforcing formatting and content rules for fields that accept text. Leads with invalid field values will be marked INVALID. Pattern validations are based on regular expressions.
The following sites offer additional regular expression resources:
- A java reference for regular expressions.
- An online testing tool for java-based (java.util.regex) regular expressions.
Examples of Commonly Used Pattern Validations
A pattern is used to determine whether a field value is valid. Leads with invalid field values will be rejected. The following table shows examples of commonly used regular expression validation patterns:
Category | Description | Example | Pattern |
Dates | Before using a pattern for date fields, try the Date or Date Of Birth field type instead | ||
Note that a date pattern will verify the format of a value, but will not reject values which don't represent real dates, such as 12/32/2005. | YYYY-MM-DD The leading 0 for month (MM) and day (DD) is optional. The year (YYYY) requires 4 digits. | 2005-12-31 | [0-9]{4}-[0-9]{1,2}-[0-9]{1,2} |
| MM/DD/YYYY The leading 0 for month (MM) and day (DD) is optional. The year (YYYY) requires 4 digits. | 12/31/2005 | [0-9]{1,2}/[0-9]{1,2}/[0-9]{4} |
YYYY-MM-DD HH:MM:SS | 1980-09-01 14:04:00 | [0-9]{4}-[0-9]{1,2}-[0-9]{1,2} [0-9]{1,2}:[0-9]{2}:[0-9]{2} | |
Letters & Digits | Letters only (exactly one, mixed case) | a | [a-zA-Z] |
| | A | |
| Letters only (one or more, mixed case) | A | [a-zA-Z]+ |
Abcde | |||
| Letters only (zero or more, mixed case) | | [a-zA-Z]* |
| | abCDE | |
| Digits only (exactly one) | 1 | [0-9] |
| Digits only (exactly nine) | 012345678 | [0-9]{9} |
| Digits only (one or more) | 12 | [0-9]+ |
| Digits only (zero or more) | 12345 | [0-9]* |
| Letters & Digits (exactly one, mixed case) | A | [a-zA-Z0-9] |
9 | |||
| Letters & Digits (exactly one or more, mixed case) | Abc123def | [a-zA-Z0-9]+ |
IP Address | IP Address (dot-quad notation) | 216.123.211.44 | Pattern no longer needed; use the built-in IP Address field type instead |
Exclude certain email addresses | Don't accept hotmail or yahoo email addresses | .*(?<!.*\@(?:hotmail|yahoo))\.(com|net|org|biz|info|name|mobi|us|tv|mil|gov|edu).* |