Skip to main content

Use RegEx to validate recipient input

Use RegEx validation to ensure recipients enter data in the correct format, reducing errors and follow-up work.

Updated over a week ago

RegEx validation ensures that your recipients enter information exactly how you need it before they can sign the document.

Check if a specific input type like Date, Email, or Checkbox already exists in GetAccept before building a custom rule. Using these built-in fields automatically handles validation for you without any extra setup.

Add a text field to your document

To start validating custom data, you first need to place a text input field within your editor block.

  1. Go to your document editor and create or select an Editor block.

  2. Click the + button inside the block and select the Text input field.

  3. Click the Settings (gear icon) on the field context menu and select Set up RegEx validation.

Pro-tip: In the field settings menu, you can also set minimum and maximum character lengths. If you mark the field as Required, the recipient cannot sign the document until the data matches your RegEx pattern.

Configure your RegEx rules

The RegEx settings modal is where you define your rules and test them to make sure they work before you send the document.

Enter your Regular Expression

In the Regular Expression field, enter the specific code pattern the input must match to be considered valid.

The expression is matched against the entire input provided by the recipient. If you enter an invalid RegEx code, GetAccept will display an error message immediately.

Below is a complete list of common patterns you can copy and paste directly into GetAccept:

Address & Location

  • Street address: [a-zA-Z\d\s\-\,\#\.\+]+

  • Zip Code (US): ^([0-9]{5}(?:-[0-9]{4})?)*$

  • State (US): ^(?:A[KLRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])*$

Contact & Web

  • Phone number (International): ^\s*(?:\+?(\d{1,3}))?([-. (]*(\d{3})[-. )]*)?((\d{3})[-. ]*(\d{2,4})(?:[-.x ]*(\d+))?)\s*$

  • Phone number (US): ^(?:\(\d{3}\)|\d{3})(?: *- *)?\d{3}(?: *- *)?\d{4}$

  • Email: [a-zA-Z0-9_\.\+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-\.]+

  • Website: ^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$

Dates & Identity

  • Date (dd/MM/yyyy): ((0[1-9])|(1[0-2]))[\/-]((0[1-9])|(1[0-9])|(2[0-9])|(3[0-1]))[\/-](\d{4})

  • Date (yyyy-MM-dd): ^\d{4}\-(0?[1-9]|1[012])\-(0?[1-9]|[12][0-9]|3[01])$

  • US Social Security / Canadian Social Insurance Number: ^(\d{3}-\d{3}-\d{3})|(\d{3}-\d{2}-\d{4})$

  • Only numbers: ^[\d\s]+$

Create a Custom Error Message

In the Custom Error field, write the message your recipient will see if they enter the wrong information.

Your error message should be helpful and direct, such as "Please enter a valid 5-digit zip code" rather than just "Invalid input."

Test your validation

Use the Test field to try out different variations of data to see if your RegEx rule catches them.

Before saving, type in a few "wrong" answers and a few "right" ones to ensure the validation triggers correctly.

  1. Click Save to apply the validation to your text field.

Did this answer your question?