Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Validation for (xxx) xxx-xxx phone number format

shilpa344
Giga Expert

Need validation for (xxx) xxx-xxx phone number format. Tried regex /^(\()?\d{3}(\))?(-|\s)?\d{3}(-|\s)\d{4}$/ but it's accepting other formats as well

1 ACCEPTED SOLUTION

ghsrikanth
Tera Guru

Could you please try this regexp -


/^\([0-9]{3}(\)) [0-9]{3}-[0-9]{4}$/;


View solution in original post

1 REPLY 1

ghsrikanth
Tera Guru

Could you please try this regexp -


/^\([0-9]{3}(\)) [0-9]{3}-[0-9]{4}$/;