电话号码验证的正则表达式 [英] Regular expression for Telephone Number validation

查看:131
本文介绍了电话号码验证的正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我需要通过遮罩控制访问英国的HouseID.为此,我给掩码格式为"?? \-?? \-?? \-?? \-?".我的要求是它应该使用带空格的字母数字.如果我给出像25-2h-3h- 5-6.但是当我取回它时,它显示为25-2h-3h-56-. 如果任何人知道正确的格式,请告诉我.

Hi,
I need to access the HouseID for UK through mask control. For this i am giving the mask Format like "??\-??\-??\-??\-?. My requirement is that it should take alphanumeric with space. If i am giving like 25-2h-3h- 5-6. But when i am retreiving this it shows like 25-2h-3h-56- . Here it is triming.
Please if anyoune know the correct format please let me know.

推荐答案

到目前为止,您尝试了什么?

看看这些免费的库,这些库将根据您的需要帮助您构建Regex:
免费的在线正则表达式生成器 [免费的Regex库 [ ^ ]
What have you tried so far?

Have a look at these free libraries that would help you in forming your Regex as per your need:
Free Online Regex Builder[^]
Free Regex library[^]


我不知道您的HouseID是什么意思,因为在英国没有这样的东西.房屋可能有名字,可以是任何字符串,也可以是数字,可以是任何数字(实际上通常少于五个),后面可能跟字母等.如果您谈论的是电话号码,那么它们通常会被写成以下形式之一,有时使用空格而不是破折号:
01234-567890
0123-456-7890
01234-567-890或01234-567890
尽管它们全都可以表示为0,后跟10位数字.
I don''t know what you mean by HouseID as there is no such thing in the UK. Houses may have names, which can be any character string, or numbers which can be any number of digits (in reality usually less than five) possibly followed by a letter etc. If you are talking about telephone numbers then they tend to be written in one of the following forms, sometimes using spaces instead of dashes:
01234-567890
0123-456-7890
01234-567-890 or 01234-567890
although they may all be expressed as 0 followed by 10 digits.


这篇关于电话号码验证的正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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