-1

My input box must accept the following combination

(123) 123-4567 or 123-123-1234

Can anyone help me out to make regular expression?

Jason
  • 91
  • 3
  • 9

1 Answers1

0

Seems trivial :

/^(\(\d{3}\) |\d{3}-)\d{3}-\d{4}$/

demo on regex101

Vivick
  • 3,434
  • 2
  • 12
  • 25