[英]Regular expression for mobile number
我正在尝试为电话号码写正则表达式,该电话号码应接受以下格式999-999-9999的输入,除此之外,它不允许我尝试过的任何其他格式
@"^[0-9-]*$"
Though i am not expert in either of your mentioned programming language but in python we can use "^\\d{3}-\\d{3}-\\d{3}$" and it will identify 999-999-999 only format. 虽然我不是您提到的任何一种编程语言的专家,但是在python中,我们可以使用“ ^ \\ d {3}-\\ d {3}-\\ d {3} $”,它将识别999-999-999的唯一格式。 May be this will help! 可能会有所帮助!
尝试
^[0-9]{3}-[0-9]{3}-[0-9]{4}$
您所需的正则表达式为^[0-9]{3}\\-[0-9]{3}\\-[0-9]{4}$
you can use jquery 你可以使用jQuery
jQuery(document).ready(function (jQuery) {
$("#<%=Phone.ClientID%>").change(function () {
// alert('Value changed!');
jQuery("input[id*=Phone]").mask("999-999-9999");
});
this will automatically mask to you format 这将自动掩盖您的格式
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.