Revision: 7617
Updated Code
at August 12, 2008 13:59 by wizard04
Updated Code
//10-digit phone number ^(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})$ //10-digit phone number, extension allowed ^(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d+))?$ //7 or 10-digit phone number ^(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})$ //7 or 10-digit phone number, extension allowed ^(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d+))?$ //10-digit phone number, vanity (alphanumeric) allowed ^(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?([2-9a-z]1[02-9a-z]|[2-9a-z][02-9a-z]1|[2-9a-z][02-9a-z]{2})([0-9a-z]{4})$ //10-digit phone number, vanity allowed, extra characters allowed at end ^(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?([2-9a-z]1[02-9a-z]|[2-9a-z][02-9a-z]1|[2-9a-z][02-9a-z]{2})([0-9a-z]{4})([0-9a-z]*)$
Revision: 7616
Updated Code
at August 12, 2008 13:56 by wizard04
Updated Code
//10-digit phone number ^(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})$ //10-digit phone number, extension allowed ^(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d+))?$ //7 or 10-digit phone number ^(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})$ //7 or 10-digit phone number, extension allowed ^(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d+))?$ //10-digit phone number, vanity (alphanumeric) allowed ^(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?([2-9a-z]1[02-9a-z]|[2-9a-z][02-9a-z]1|[2-9a-z][02-9a-z]{2})([0-9a-z]{4})$ //10-digit phone number, vanity allowed, extra characters allowed at end of number ^(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?([2-9a-z]1[02-9a-z]|[2-9a-z][02-9a-z]1|[2-9a-z][02-9a-z]{2})([0-9a-z]{4})([0-9a-z]*)$
Revision: 7615
Updated Code
at August 12, 2008 13:09 by wizard04
Updated Code
//10-digit phone number ^(?:\+?1\s*[.-]?\s*)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*[.-]?\s*([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*[.-]?\s*([0-9]{4})$ //10-digit phone number, extension allowed ^(?:\+?1\s*[.-]?\s*)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*[.-]?\s*([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*[.-]?\s*([0-9]{4})(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d+))?$ //7 or 10-digit phone number ^(?:(?:\+?1\s*[.-]?\s*)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*[.-]?\s*)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*[.-]?\s*([0-9]{4})$ //7 or 10-digit phone number, extension allowed ^(?:(?:\+?1\s*[.-]?\s*)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*[.-]?\s*)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*[.-]?\s*([0-9]{4})(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d+))?$ //10-digit phone number, vanity (alphanumeric) allowed ^(?:\+?1\s*[.-]?\s*)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*[.-]?\s*([2-9a-z]1[02-9a-z]|[2-9a-z][02-9a-z]1|[2-9a-z][02-9a-z]{2})\s*[.-]?\s*([0-9a-z]{4})$ //10-digit phone number, vanity allowed, extra characters allowed at end of number ^(?:\+?1\s*[.-]?\s*)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*[.-]?\s*([2-9a-z]1[02-9a-z]|[2-9a-z][02-9a-z]1|[2-9a-z][02-9a-z]{2})\s*[.-]?\s*([0-9a-z]{4})(?:\s*([0-9a-z]+))?$
Revision: 7614
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 31, 2008 14:10 by wizard04
Initial Code
//10-digit phone number ^(?:\+?1\s*[.-]?\s*)?(?:\(\s*([2-9]1[0,2-9]|[2-9][0,2-8]1|[2-9][0,2-8][0,2-9])\s*\)|([2-9]1[0,2-9]|[2-9][0,2-8]1|[2-9][0,2-8][0,2-9]))\s*[.-]?\s*([2-9]1[0,2-9]|[2-9][0,2-9]1|[2-9][0,2-9]{2})\s*[.-]?\s*([0-9]{4})$ //10-digit phone number, extension allowed ^(?:\+?1\s*[.-]?\s*)?(?:\(\s*([2-9]1[0,2-9]|[2-9][0,2-8]1|[2-9][0,2-8][0,2-9])\s*\)|([2-9]1[0,2-9]|[2-9][0,2-8]1|[2-9][0,2-8][0,2-9]))\s*[.-]?\s*([2-9]1[0,2-9]|[2-9][0,2-9]1|[2-9][0,2-9]{2})\s*[.-]?\s*([0-9]{4})(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d+))?$ //7 or 10-digit phone number ^(?:(?:\+?1\s*[.-]?\s*)?(?:\(\s*([2-9]1[0,2-9]|[2-9][0,2-8]1|[2-9][0,2-8][0,2-9])\s*\)|([2-9]1[0,2-9]|[2-9][0,2-8]1|[2-9][0,2-8][0,2-9]))\s*[.-]?\s*)?([2-9]1[0,2-9]|[2-9][0,2-9]1|[2-9][0,2-9]{2})\s*[.-]?\s*([0-9]{4})$ //7 or 10-digit phone number, extension allowed ^(?:(?:\+?1\s*[.-]?\s*)?(?:\(\s*([2-9]1[0,2-9]|[2-9][0,2-8]1|[2-9][0,2-8][0,2-9])\s*\)|([2-9]1[0,2-9]|[2-9][0,2-8]1|[2-9][0,2-8][0,2-9]))\s*[.-]?\s*)?([2-9]1[0,2-9]|[2-9][0,2-9]1|[2-9][0,2-9]{2})\s*[.-]?\s*([0-9]{4})(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d+))?$ //10-digit phone number, vanity (alphanumeric) allowed ^(?:\+?1\s*[.-]?\s*)?(?:\(\s*([2-9]1[0,2-9]|[2-9][0,2-8]1|[2-9][0,2-8][0,2-9])\s*\)|([2-9]1[0,2-9]|[2-9][0,2-8]1|[2-9][0,2-8][0,2-9]))\s*[.-]?\s*([2-9a-z]1[0,2-9a-z]|[2-9a-z][0,2-9a-z]1|[2-9a-z][0,2-9a-z]{2})\s*[.-]?\s*([0-9a-z]{4})$ //10-digit phone number, vanity allowed, extra characters allowed at end of number ^(?:\+?1\s*[.-]?\s*)?(?:\(\s*([2-9]1[0,2-9]|[2-9][0,2-8]1|[2-9][0,2-8][0,2-9])\s*\)|([2-9]1[0,2-9]|[2-9][0,2-8]1|[2-9][0,2-8][0,2-9]))\s*[.-]?\s*([2-9a-z]1[0,2-9a-z]|[2-9a-z][0,2-9a-z]1|[2-9a-z][0,2-9a-z]{2})\s*[.-]?\s*([0-9a-z]{4})(?:\s*([0-9a-z]+))?$
Initial URL
http://en.wikipedia.org/wiki/North_American_Numbering_Plan
Initial Description
(Created for JavaScript) These are rather forgiving. Spaces, dashes, or periods are allowed as separators. Extensions can be recognized by several strings (#, x, x., ext, ext., extension). Area code: $1$2 Exchange code: $3 Station code: $4 Extension / Extra characters: $5 Separators are not accepted within the $3$4$5 portion of a vanity number. Example: (540) 555-0123 ext.678 --> `($1$2) $3-$4 ext.$5` Example: 1-800-GOODFOOD --> `1-$1$2-$3$4$5`
Initial Title
Regular Expressions for U.S. Phone Numbers
Initial Tags
regex, javascript, phone
Initial Language
Regular Expression