Restrict letters in question type text

I want to request your help. In a text type question, how can I restrict the entry of letters and allow only numbers and the hyphen symbol “-”.

Hi @inesen2021gt, welcome to the community! Please have a look at the support article below and see if it solves your need :slightly_smiling_face:

1 Like

see the article, however it did not work for me, because it allows me to enter numbers at the beginning and then letters. The function you use is the following: regex (., ‘[0-9 -]’)

Hi @inesen2021gt, you need to ensure you enclose the expression between the start and end characters: ^ and $.

regex(., '^[0-9-]+$')
1 Like

Thanks for the help @Josh , it worked fine for me. Regards.