1 Comment

  • Assuming javascript regular expressions don't stray too far from the standard, you can shorten this a lot. Not that it matters a whole lot if this one works, but it's good knowledge to have

    ^\d{3}-?\d\d-?\d{4}$

    \d is equivalent to [0-9]

    And if you're matching a single character, you don't need to make it a character class ([-]? is equivalent to -?)

Comments have been disabled for this content.