Validation pattern to limit data entry to 6 whole numbers

  • 6 December 2018
  • 1 reply
  • 3 views

Userlevel 3
Badge +16

Hi,

 

Got a text box where the requirement is for a user to enter a Whole number. That number can be 6 digits or less, is this possible using a Validation pattern?

 

I'm using the following pattern to check that only Whole Numbers are entered, but there is no limit to the number of digits. Any ideas how to limit to 6 or less?

 

^[0-9]+$

 

Thanks


1 reply

Userlevel 6
Badge +16

Hi,


 


Perhaps you can add range quantifier {min, max} to it.


^[0-9]{1,6}$

Reply