Regex for Only Numbers / letters

5805
3
01-30-2019 03:55 AM
PamelaLandy
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 

regex(${IDEPRONUMBER},'[0-9]\d{11}')

And another regex for Only letters  

regex(${IDEPRONAME},'^[A-Za-z]')

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
Arturo_FranciscoAcosta_Bazán
Occasional Contributor

Only letters :

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

Only numbers :

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

SarahHartholt
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
SarahHartholt
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:https://community.esri.com/thread/224012-regex-function-syntax 

0 Kudos