Restrict length of batch number

How I input a batch number to be from 3 to 8 digits.

Hi @Jean_Amukwatse, welcome to the forum and thanks for adding your profile picture. It helps build community! We're glad you're here. When you get a chance, please introduce yourself on this forum thread.

In the phone number constraint example with (regex(.,'[0-9]{11}')) the {11} is checking for a length of 11. The {} can take 2 arguments {min,max}. So for a batch number of 3-8 digits of all numbers you could do appearance = numbers and constraint = regex(.,'^[0-9]{3,8}$').

More details in the documentation on using regular expressions can be found in the docs.

Thank you @danbjoseph
This is failing on my end.

So I want to be able to input alphanumeric digits with a minimum of 3 characters and a max of 8.

In that case, don't use appearance and for constraint use regex(.,'^[A-Z0-9]{3,8}$') for capital letters, regex(.,'^[a-z0-9]{3,8}$') for lowercase, or regex(.,'^[A-Za-z0-9]{3,8}$') for either.

You should also add a constraint_message that explains to the user the restrictions on the answer.