Validating text input
attribute works with the following input types: text, search, url, tel, email, and password.
Tip: Use the global title attribute to describe the pattern to help the user.
When you validate text data to check if it contains a certain value, there are two additional steps to take after selecting the condition: condition is used for entering regular expressions to create custom validation criteria.
For example, use this regular expression to ensure that ten consecutive numeric digits are entered in a phone number field: If you use regular expression validation, provide some explanatory text (e.g., help text, placeholder text, and a clear error message) to guide form users in entering the proper data.
Figure 4: Regular expression text validation opens up countless possibilities.
The hint is displayed in the input field before the user enters a value.
If the condition isn’t met, an error message is displayed to the user.