Hi All,
i’m getting an input excel in that i’m having mobile numbers from different countries i want to extract mobile number without country code. I tried few codes on my own but i’m able to do for few, i’m unable to write regex code for all. can anyone help me on this.
Can you try the following sample? This returns country code and phone number properly except
18005551234 because we cannot identify country code is 1 or 18. (However, we can estimate it’s 1 (US)… )
mc = System.Text.RegularExpressions.Regex.Matches(yourString,"^(?<COUNTRYCODE>\+\d{1,2}|\d{1,2}(?=\W))?[-\s]*(?<PHONENUMBER>.+)",System.Text.RegularExpressions.RegexOptions.Multiline)