如何使用正则表达式移动号码 [英] How Do I Use Regex For Mobile Number
问题描述
团队,
我在Regex中有点困惑。
我有手机号码文本框。我想要手机号码的正则表达式。手机号码格式为
99999 99999
条款及细则如下:
手机号码有10个号码。
手机号码中的第一个号码必须在 1到9
之间。
之后4号必须 0到9
之后它应该是空格
之后应该是5个数字那个是 0到9
i试过这个。
var regExpMobileNumber1 = / ^ \d { 5 }(1-9)\d { 4 } \\\ { 5 } $ /;
但它不起作用..
请告诉我哪里出错了..
/;
但它不起作用..
请告诉我哪里出错了..
试试:
var regExpMobileNumber1 = / ^ [1-9] \d { 4 , 4 } \\\ { 5 , 5 }
/
Team,
I am Little bit confused in Regex.
I have the mobile number textbox.I want regex for Mobile Number. Format of mobile number is
99999 99999
Terms and Condition are as follow:
mobile numbers has 10 numbers.
first number in mobile number must between 1 to 9
.
And after that 4 number must be 0 to 9
and after it should be space
and after it should be 5 numbers that is 0 to 9
i have tried this.
var regExpMobileNumber1 = /^\d{5}(1-9)\d{4}\s\d{5}$/;
but its not working..
Kindly tell me where i am getting wrong..
/;
but its not working..
Kindly tell me where i am getting wrong..
Try:
var regExpMobileNumber1 = /^[1-9]\d{4,4}\s\d{5,5}
/;
这篇关于如何使用正则表达式移动号码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!