Dear community,

I am trying to restrict up to 2 digits (numbers from 0 to 99) my regex function in combination with decimal as type of question.

Thanks to your articles, I come up with the following:

regex(.,‘^([0-9]{1,2})+( \ .[0-9]{1,3})?$’)

The part about the decimal works perfectly, however restriction on the numbers before decimals does not work.

What do I miss?

Thanks!

Lavinia

@Lavinia, so if I understood you correctly, you are trying to restrict an entry from `0`

to `99`

with a `2`

digit decimal. Correct?

Hi Kal_Lam,

I need to restrict a number to 2 digits. This could also have decimals, (up to 3 digits) that’s why I used a decimal as type of question.

regex(.,‘^(**[0-9]{1,2})**+( \ .[0-9]{1,3})?$’)

To give more context, I am using this question to enter a tickness in cm that needs to be between 0,001 and 99,999 cm

Thanks for your support

Hi @Lavinia,

`regex(., '^\d{1,2}(\.\d{1,3})?$')`

should do the trick

1 Like

Perfect, it works! thanks

2 Likes