电话号码掩码和验证? [英] Phone number mask and validation ?

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

问题描述

我有一个文本框输入电话号码,电话号码字段当前是免费文本。用户应该可以输入10个字符,并且应该放入这种格式。如果用户输入这些格式,也应该允许这些格式way.9-999-999-9999,(999)999-9999,(999)999-9999。怎么做?哪些正则表达式可以用于这些验证?



我尝试过:



i试过jquery.maskedinput.js







< script type =text / javascript>

$(#phone)。mask(999-999-9999);

I have a textbox to enter phone number,phone number fields are currently free text.The user should be able to enter 10 characters and it should be placed into this format.These formats should also be allowed if the user enters them this way.9-999-999-9999,(999) 999-9999,(999)999-9999.How to do this? which regular expressions could be used for these validation?

What I have tried:

i have tried jquery.maskedinput.js



<script type="text/javascript>
$("#phone").mask("999-999-9999");

推荐答案

(#电话)。mask(999-999-9999);
("#phone").mask("999-999-9999");


引用:

哪个常规表达式可以用于这些验证吗?

which regular expressions could be used for these validation?



一些工具可以帮助你构建和调试regEx。



这是RegEx文档的链接:

perlre - perldoc.perl.org [ ^ ]

以下是帮助构建RegEx的工具的链接并调试它们:

.NET正则表达式测试程序 - 正则表达式风暴 [ ^ ]

快速正则表达式工具 [ ^ ]

这个显示RegEx是一个很好的图表,它非常有助于理解RegEx的作用:

Debuggex:在线视觉正则表达式测试。 JavaScript,Python和PCRE。 [ ^ ]


A few tools to help you to build and debug regEx.

Here is a link to RegEx documentation:
perlre - perldoc.perl.org[^]
Here is links to tools to help build RegEx and debug them:
.NET Regex Tester - Regex Storm[^]
Expresso Regular Expression Tool[^]
This one show you the RegEx as a nice graph which is really helpful to understand what is doing a RegEx:
Debuggex: Online visual regex tester. JavaScript, Python, and PCRE.[^]


您好,



您能查看以下链接:
Hi,

Can you please check the below link:
Matches a phone number with at least 7 digits

一旦打开链接,请点击屏幕左侧面板上的电话号码(7位数字)



希望这会有所帮助。

Once you open the link kindly click on link Phone number (7+ digits) which is at left panel of screen.

Hope this will help.


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

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