0 Replies Latest reply: Dec 16, 2013 6:04 PM by Brian Garland RSS

    RegEx Question

    Brian Garland

      I'm using this RegEx in my script to test if a phone number field actually contains a valid phone number:

       

      ^(?:\([2-9]\d{2}\)\ ?|[2-9]\d{2}(?:\-?|\ ?))[2-9]\d{2}[- ]?\d{4}$

       

      This works fine. But it turns out that my source data sometimes has extensions tacked on to the end of the phone number in the form of an underscore and three or four digits:  _123 or _1234

       

      Any RegEx experts out there who know how to add these optional extensions to my RegEx?