What will the regression expression look like for a telephone number of this type only, for example, +7 (345) 555-55-55

I found an option to check the phone number of this type +7345555555

/^\+7[345689]{1}\d{9}$/ 

How to modify it for my version? +7 (345) 555-55-55

  /^\+7\([345689]\){1}\d{9}$/ 
  • just add brackets to where they are needed. Parentheses must be escaped, so write them in the form \( - Mike
  • like this? something does not come out (put the code in the message) - werty

1 answer 1

If you need a three-digit code 345

 /^\+7\(345\) \d{3}-\d{2}-\d{2}$/ 

Test

If you need any three-digit code

 /^\+7\(\d{3}\) \d{3}-\d{2}-\d{2}$/ 

Test