Attempting to Validate Phone # input

  • 8 February 2019
  • 1 reply
  • 141 views

I am attempting to create regular expression validation of one of my single line text field inputs that is supposed to be accpeting a phone number. Formatted as ###-###-####. 

 

I have tried:

35i37FA95DFAFB8A57A.png

as well as the following: ^d{3}[-]d{3}[-]d{4}? 

 

And seemingly correct input is still failing to validate

 

37iB1CBBCB1C28720EC.png

Used https://regexr.com/ to validate all of these so not sure what I am missing...


1 reply

Userlevel 7
Badge +17
Hi,

I remember I was having some issues with the d , s and other regex characters.
I checked the below pattern:
[0-9]{3}-[0-9]{3}-[0-9]{4}
And it seems to work.

However, what might be significant, when I copied and pasted it, it wasn't working. When I typed it from a scratch it started to work. Weird...

Regards,
Tomasz

Reply