Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

built a logic to mask phone number with regex code, small issue

$
0
0

Hello, I have built the following logic to mask a US phone number and validate it with regex code. It works fine when I enter in 9876543210 format and changes accordingly to (987) 654-3210. However, when I enter +19876543210 it returns +1 (987) 765-4321. The third digit of the area code gets repeated and the last digit is gone. Can someone please help me with this ? 

The regex code I am using is  

var regexCode = /^\s*(?:\+?(\d{1,3}))?[- (]*(\d{3})[- )]*(\d{3})[- ]*(\d{4})(?: *[x/#]{1}(\d+))?\s*$/;


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images