任何人都可以给我一个匹配电话号码的正则表达式 [英] Can Anybody give me a regex expression for matching phone numbers

查看:138
本文介绍了任何人都可以给我一个匹配电话号码的正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,



任何人都可以给我正则表达式来匹配这些...



号码应超过三位数。

号码不得超过20位..



+41 5203 789850应该匹配

+41 523 - 586 - 789 -789应该匹配

10.20.13.20:8080不匹配

123.45.20.125不匹配

+91 9544337661应该匹配

+91(475)2250010应匹配

1200应匹配



谢谢



OP从以下评论复制的附加信息

肯定... 。



Hi friends,

Can anybody please give me Regex Expressions to match these...

The number should be more than three digits..
The number should not exceed 20 digits..

+41 5203 789850 should match
+41 523 - 586 - 789 -789 should match
10.20.13.20:8080 should not match
123.45.20.125 should not match
+91 9544337661 should match
+91 (475) 2250010 should match
1200 should match

Thanks

additional information by the OP copied from comment below
sure....

var exp = new Regex(@"#?[0-9\s\-\(\)]{4,20}", RegexOptions.IgnoreCase);





我想要的是获得数字有mor超过4位数。

但它计算表达式中的所有内容...例如:它也返回(20)和20(因为它有空格)....

如果数字超过4位数,我该如何选择,如果它包含这个特殊字符,请选择其余数字...



What I want is to get the numbers having more than 4 digits.
But its counting everything in the expression... For eg: It returns (20) and 20 too (since it has space)....
How can I choose only if the numbers are more than 4 digits, and select the rest if it contains this special characters...

推荐答案

检查这个链接 [ ^ ]


这篇关于任何人都可以给我一个匹配电话号码的正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆