Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

javascript phone regex (See related posts)

339-4248
339-42-48
339 42 48
339 4248
3394248
(095) #phone#
(095)#phone#
+7 (095) #phone#
+7 (095)#phone#
+7(095) #phone#
+7(095)#phone#

/^(\+\d)*\s*(\(\d{3}\)\s*)*\d{3}(-{0,1}|\s{0,1})\d{2}(-{0,1}|\s{0,1})\d{2}$/

Comments on this post

chrelad posts on Dec 27, 2007 at 17:14
Heya transphorm,

I just added a bit on so that it supports zip-###-#### format also :D

/^(\+\d)*\s*((\(\d{3}\)|\d{3}\-)\s*)*\d{3}(-{0,1}|\s{0,1})\d{2}(-{0,1}|\s{0,1})\d{2}$/

Thanks for the great find!

Chrelad

You need to create an account or log in to post comments to this site.


Related Posts