Skip to main content
1 of 3
Joe DeRose
  • 3.6k
  • 3
  • 30
  • 35

Your regex pattern seems to be designed to allow a 9 or 8 at the beginning, but it would be better to enclose that choice in parentheses: /^(9|8)[0-9]{9}/.

More to come on the rest of your question ...

Joe DeRose
  • 3.6k
  • 3
  • 30
  • 35