Three-digit-integer_Constraint-not working

Hi, all.
For an integer type question, I put the constraint regex(.,'[0-9]{3}') for three digit integer ;
the problem is that the field is not accepting values like 001, 002, etc.
how do I define that constraint to allow three -digit integers including 001, 002,012,356, etc.
In advance, thanks for your replies.
Best,

regex's apply to strings, not integers per se. So please make sure your question type is text not integer. Also, for universal compatibility, I'd suggest including the start and end string delimiters in your regex expression; specifically

regex(.,'^[0-9]{3}$')

2 Likes

Hi, @Xiphware.
Thank you so much, for your very helpful answer and advices.
Cheers,

Also,

You could have data type as string then have the appearance as "numbers" the regex will work fine. This minimizes errors since only a numeric keyboard is displayed.

1 Like

well noted!
Many thanks, @paul_macharia.
Best,