Regex Validation for custom length digits
Here is how you can validate 5, 6, 7, 8, 9, 10, n… digits as per your requirement using Regex validation.
- Edit the block where you want this validation.
- Select input type as Text Input
- Select ‘Regex’ from the User Input Validation drop down.
- Enter your custom Regex validation and the validation message as shown in below image.
- Save the block!
Bonus: Here is the Regex validation text for verifying if the user has entered ‘N’ length of digits.
- Validate if there is 1 Digit in the text – ^[0-9]{1}$
- Validate if there are 2 Digits in the text – ^[0-9]{2}$
- Validate if there are 3 Digits in the text – ^[0-9]{3}$
- Validate if there are 4 Digits in the text – ^[0-9]{4}$
- Validate if there are 5 Digits in the text – ^[0-9]{5}$
- Validate if there are 6 Digits in the text – ^[0-9]{6}$
- Validate if there are 7 Digits in the text – ^[0-9]{7}$
- Validate if there are 8 Digits in the text – ^[0-9]{8}$
- and so on…