A regular expression, often abbreviated as regex, is a sequence of characters that forms a search pattern. It’s a powerful tool used in various computing tasks, such as searching, replacing, input validation, parsing, and more.
In the context of input validation, regex can be used to check if user input matches a particular pattern. This is known as “regex validation”.
For example, let’s say you’re designing a form on a website and you want to make sure users are inputting valid email addresses. A very simple regex pattern for email validation might look like this:
^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
Steps to enable regex validation #
- Go to the Form Builder of the selected form.
- Choose the required form field.
- Go to the Field Options > Advanced Option.
- Enable Regex Validation
Choose the required expression from the list in the <> button. You can provide custom validation messages as well. Hit Save and you are good to proceed with the form submission.