Reg ex for mobile phones

hi guys. Currently I’m using this reg ex to extract phone numbers
“(?<!\d)(?=01)\d{11,12}(?!\d)”

I’m able to match numbers with following format:

01628007384
016280073842

But I also need to match numbers with empty spaces in between like
0162 800 7384
or those numbers
0162-800 7384

How can I achieve this? Thanks for your help in advance.

Hi,

How about the following expression?

System.Text.RegularExpressions.Regex.Match(yourString,"(?<!\d)01(\d |\d-|\d){9,10}(?!\d)").Value

Regards,

1 Like

Try this Regular Expressions: (?<!\d)[0-9]{1,}(\d |\d-|\d){9,10}(?!\d)

1 Like

Thank you, I tried the solution @Yoichi posted, and my first tests were fine I think.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.