Re: Pronunciation of phone numbers

Luke Davis

On Sun, 27 Sep 2020, Brian Vogel wrote:

On Sun, Sep 27, 2020 at 12:41 AM, Luke Davis wrote this regular expression:
\(?(\d)(\d)(\d)(?:\)?[ \.-]|\))(\d)(\d)(\d)[ \.-](\d)(\d)(\d)(\d)\D
-By the way, that's very, very elegant for the purpose.  I never want you to think that my comments on the group are meant to be critical/disparaging in any
way.  I'm just generally going for "quick and dirty for the common cases" while you are being incredibly thorough, and the latter is more complicated and
requires great skill.I'd actually forgotten about non-capturing groups with alternatives.  A master stroke!
Thank you! Regular expressions are amazing tools, and I delight in building one that gets the job done while eliminating as many false positives as possible.

Although ones like this are really hard to read! :)


Join to automatically receive all group messages.