With forms you sometimes to need to check the format of fields to ensure they are formatted as you would expect them to be. Some examples of formatted fields include:
- Email Addresses
- Social Security Number
- A number that is xx digits long (e.g. NPI number is always 10 digits long)
- Only letters and specific symbols allowed
To check the format of the data entered into a field you will need to use the Control Regular expression formula for that field.
To do that, double-click on the field to open the Control Settings for the field. Click on the Validation + mark to expand the section, for Use a regular expression select Yes. You can then enter a Regular expression (examples below) and a error message for that field.
Regular Expression Examples
Email Address format
Social Security Number format
A 10 digit long number format
Between a 7 and 9 digit long number format
Alphanumeric (no special characters)
Phone Number with area code (allows either dashes or periods in between the numbers):
Creating your own Regular Expressions
I found a really useful site (http://www.regexr.com/) which I’ve found helpful to create and test regular expressions.
**Please note, do not use either the ^ or $ at the start or end of your expressions on the regexr site, these symbols should only be used on a single line of text field. The test text on that site is in a multi-line text field so if you use either of those symbols you will get incorrect results.
Example of testing the email formating on RegExr: