Comments on: Regular expression for US and Canada phone number https://www.harshbaid.in/2013/08/03/regular-expression-for-us-and-canada-phone-number/ Sitecore & Microsoft Certified Software Engineer Mon, 27 Nov 2017 19:18:47 +0000 hourly 1 https://wordpress.org/?v=6.5.2 By: Tyler Breau https://www.harshbaid.in/2013/08/03/regular-expression-for-us-and-canada-phone-number/#comment-7600 Mon, 27 Nov 2017 19:18:47 +0000 http://www.harshbaid.in/?p=622#comment-7600 This regex is flawed. (123-456-7890 and 123)-456-7890 passes as a valid format.

]]>
By: jpeavey https://www.harshbaid.in/2013/08/03/regular-expression-for-us-and-canada-phone-number/#comment-3117 Tue, 23 Feb 2016 21:39:08 +0000 http://www.harshbaid.in/?p=622#comment-3117 This works for the format, doesn’t actually ensure valid phone numbers. See http://www.regexplanet.com/cookbook/phone-number-nanp/index.html

]]>
By: manmohan https://www.harshbaid.in/2013/08/03/regular-expression-for-us-and-canada-phone-number/#comment-2789 Fri, 02 Oct 2015 13:39:52 +0000 http://www.harshbaid.in/?p=622#comment-2789 Thank you Subham it helped me a lot

]]>
By: shubham jain https://www.harshbaid.in/2013/08/03/regular-expression-for-us-and-canada-phone-number/#comment-2235 Mon, 13 Apr 2015 06:28:20 +0000 http://www.harshbaid.in/?p=622#comment-2235 Thanks for regular expression.

I have modified your regular expression that works for following US phone number.

regExp -> /^[+]?[0-9]{0,1}[-. ]?\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/

1444-555-1234
1-444-555-1234
14325678901
1(123)456-7890
+1 246.555-8888
+1 (123)456-7890
+1(123)456-7890

Thanks,
Shubham

]]>