Was this article helpful?
Thanks for your feedback
The Validation (Regex) property helps you define a set of validation options for a given field.
In general, this field property is used to perform validation checks (format, length, etc.) on the value that the user enters in a field. If the user enters a value that does not pass these checks, it will throw an error.
You can define validation rules by specifying custom validation regular expressions in this property.
Let’s consider a few examples:
^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-z]{2,3}$
^(http:\/\/|https:\/\/)?www\.[a-zA-Z0-9:?&=._/-]+\.[a-zA-z]{2,3}$
^(?:(?:31(\/|-|\.)(?:0?[13578]|1[02]))\1|(?:(?:29|30)(\/|-|\.)(?:0?[1,3-9]|1[0-2])\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})$|^(?:29(\/|-|\.)0?2\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:0?[1-9]|1\d|2[0-8])(\/|-|\.)(?:(?:0?[1-9])|(?:1[0-2]))\4(?:(?:1[6-9]|[2-9]\d)?\d{2})$
Note: The Validation (Regex) property is available only for Single Line and Multi-Line text box fields.
When a regular expression either contains a complex validation logic or receives a lengthy input string, executing the validation check becomes time-consuming. The browser has to make millions of backtracking trips through the input string to meet the defined regex validation checks. Regular expressions like these either end up freezing the browser or utilizing 100% of the CPU core process. This issue is known as "catastrophic backtracking."
You can solve this problem in two ways:
Learn more about catastrophic backtracking here.
Additional Resource: Catastrophic backtracking can cause a regular expression denial of service (ReDOS) attack. Read more.
To search for invalid regexes within your stack, please refer to our Regex Validation CLI Plugin guide.
Learn more about regular expressions in the official documentation.
Was this article helpful?
Thanks for your feedback