Developers » Regular Expression Validators


Regular Expression Validators

Quick Links

You can use regular expressions to define a standard pattern for end user input, such as a specific date format or properly formatted email address. Regular expression validators give you the ability to ensure that user input meets those patterns. You can use regular expression validators in custom fields.

For example, you want ensure that users provide valid dates in the dd/mm/yyyy format, and ask them to correct an invalid date. To do this, you need to:

  1. Create a regular expression validator where expession is ^([3][0-1]|[0-2][0-9])[\/]([0-1][0-2]|[0][0-9])[\/][0-9]{4}$ and the message is Please provide a valid date in the dd/mm/yyyy format.
  2. Add the validator to a custom field. 

To open the Regular Expression workspace, go to Setup > Development > Regular Expression Validators.

Create New Regular Expression Validator

[Back to top]

To create a new regular expression validator:

  1. In the Regular Expression Validators workspace, click the  Add New link:
  2. Complete the form fields:
    • Name: Enter a name.

    • System ID: A unique identifier, automatically generated when you name an object. You can use this identifier to reference an object in scripts, templates, tags, and through the API. You can change the System ID by selecting the pencil icon. Use caution when changing the ID as it can affect existing scripts associated with the object. For more information, see System ID.

    • Description: Add a brief description. This is used as an internal note for administrators.
    • Expression : Enter a regular expression sequence.
    • Message : Enter a message to display to the end user when the entered value doesn't meet the requirements of the expression validator. The message can be translated by using the dictionary key in the message field. Note that the dictionary key needs to start with “custom” such as “custom.key.ssnError”.
  3. Click Save

Add Regular Expression Validator to a Custom Field

You can add a regular expression validator to these custom field types:

To add a regular expression validator to all the above fields except Table Controller:

  1. Go to Setup > Fields & Forms > Custom Fields and add a new  custom field, or edit an existing field.
  2. Select the Advanced tab.
  3. Select the validator to use from the Regular Expression Validator list.
  4. Click Add or Update.

You can add a regular expression to one or more columns of a Table Controller while customizing the columns. For more information, see Table Controller. To add a regular expression validator to a Table Controller:  

  1. Go to Setup > Fields & Forms > Custom Fields and add a new Table Controller, or edit an existing field.  For more information about creating a new custom field, see Create New Custom Field
  2. On the Basic tab, click Customize Controller.
  3. Select Add New Column.
  4. Select the Validation checkbox and click the Details button.
  5. Select the validator to use from the Regular Expression list.
  6. Click Save to save the validation configuration.
  7. Click Save and Back to finish customizing the table controller.
  8. Click Update.

Manage Regular Expression Validators

You can perform the following actions in the Manage Regular Expression Vaildators workspace:


Sort the list on a column

Point at the column name and click the arrow. 

Search existing validators

In the Filter field, select the name of the column you want to search, then select the filter conditions and criteria.

Edit a validatorClick Edit next to the validator name.

See the details

The details show the status, system ID, task creation and update details, and name of the user who created and updated the validator. 

Click the Actions  button and select Details.

Delete a validator

You cannot delete objects that are used in default settings, or objects that are in use.

Click the Actions  button and select Delete.