Constructs a regular expression from text.

See and for information about regular expressions.


Regex(exp, flag)

Enabled For

For a description of the business object categories, see Notes on "Enabled For".

Business Object Category Yes/No
Business Rules: Before-Save Rules Yes1
Business Rules: Calculation Rules (After Save, with or without Also Recalculate on Load) Yes
Business Rules: Calculation Rules (Before Save or Always, without Also Recalculate On Load) Yes1
Business Rules: Calculation Rules (Before Save or Always, with Recalculate On Load) Yes
Business Rules: Editing Rules Yes1
Business Rules: Initialization Rules Yes1
Business Rules: Read Only Rules Yes1
Business Rules: Required Rules Yes1
Business Rules: Validation Rules Yes1
Client Expressions Yes
Object Permissions No
Services Yes
Mobile Yes
Quick Actions (except UI Quick Actions) Yes1
UI Quick Actions Yes
Reports Yes1
Search/Dashboard without field references Yes1
Search/Dashboard with field references No
1. Except in services.


exp The regular expression, without slashes.
flag (Optional) The flags associated with the regular expression.

Return Value

Regular expression, which is a text value.


Regex("^(([^<>()[\]\\\\.,;:\\[email protected]\\"]+(\\.[^<>()[\\]\\\\.,;:\\[email protected]\\"]+)*)|(\\".+\\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$","i")

This example returns a regular expression that matches a valid email address.