Regular Expressions 101

Library entries

Match a phone number formatted using North American Numbering Plan (NANP)

Vote

0

Regular Expression
python

"
^[ ]*(?:(?:\+)?1)?[ ]*(\()?(?:[2-9][0-9]{2})(?(1)\))[ ]*(?:-|\.)?[ ]*(?:[2-9][0-9]{2})[ ]*(?:-|\.)?[ ]*[0-9]{4}[ ]*$
"
gm

Description

Loading markdown...
Submitted by Nishant Misra - a month ago