Project Demos

valid_nanp


(use # as a replacement for numbers, and any other character for formatting, e.g., "(###) ###-#### x####")

Examples

[valid_nanp('631-960-7187')]

true

[valid_nanp('401-285-0696', -format='(###) ###-#### x######')]

(401) 285-0696

[valid_nanp('oogahboogah401oopsie-285-0696ext12345',
-format='(###) ###-#### x######')]

(401) 285-0696 x12345

Read the article valid_nanp - Validate phone numbers according to the North American Numbering Plan.

To support my free open source software efforts, please consider using Gratipay to thank me (or any other awesome developer or organization). You can give as little as 25¢ per week.

Or for a one-time donation, you can use PayPal.

Donate Now