Regex for Only Numbers / letters

01-30-2019 03:55 AM
Occasional Contributor

hello, I'm trying to make a REGEX to validate an entry of only numbers from 0 to 9 of length 11 characters, following the YYY route

Phone Number Field 


And another regex for Only letters  


But I get error
I do not want to use a mask  '9999999999', in case for number as mentioned in this development and errors can occur if someone has the regex can I share?

Tags (1)
0 Kudos
3 Replies
Occasional Contributor

Only letters :

regex(.,'^[A-Za-z]*$')  and string-length(.)= max num 

Only numbers :

regex(.,'^[0-9]*$') and string-length(.)=max num

Occasional Contributor III

what would the expression be if I want the user to input numbers and special characters only, or only numbers and the characters ()- ? I have a phone number question in my survey and just noticed that someone has filled it in with letters

0 Kudos
Occasional Contributor III

I solved it by adding a hidden field named 'character' and setting the default string to: ^[()-1234567890 ext.]+$

Then setting the constraint field for the phone number question to: regex(.,${characters})

with the help of this post: 

0 Kudos