[SalesForce] Regex validation for Phone Number

I am trying to create a validation rule for US format number and using the following regex Validation

NOT(REGEX(Phone, "\\D*?(\\d\\D*?){10}"))

The above seems like a standard regex which will only allow saving for (000) 000-0000 format number.

However, if I enter characters in the following format
(000) 000-0000yyy. It is still allowing save.

Best Answer

You can try the below one as this could make sure that the phone contains only numbers.

NOT( OR( ISBLANK(Phone), REGEX( Phone,"(\\D?[0-9]{3}\\D?)[\\s][0-9]{3}-[0-9]{4}")))