如何使用正则表达式移动号码 [英] How Do I Use Regex For Mobile Number
本文介绍了如何使用正则表达式移动号码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hello Team,
我在Regex中有点困惑。
我有手机号码textbox。我想要手机号码的正则表达式。手机号码的格式是
99999 99999
条款和条件如下:
手机号码中的第一个号码必须介于1到9之间
在5号之后它应该是空格。
i试过这个。
var regExpMobileNumber1 = / ^ \d {5}(1-9)\d {4} \\\ {5} $ /;
但它不起作用..
请告诉我哪里出错了..
谢谢
Harshal Raut
Hello 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:
first number in mobile number must between 1 to 9
after 5 number it should be space.
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..
Thanks
Harshal Raut
推荐答案
/;
但它无法正常工作..
请告诉我哪里出错了..
谢谢
Harshal Raut
/;
but its not working..
Kindly tell me where i am getting wrong..
Thanks
Harshal Raut
[1-9][0-9]{4}( ){0,1}[0-9]{5}
试试这个(测试grep)
^ [0-9] { 5} [0-9] {5}
try this (tested for grep)
^[0-9]{5} [0-9]{5}
这篇关于如何使用正则表达式移动号码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文