关于正则表达式

1、 正则表达式30分钟入门教程

http://deerchao.net/tutorials/regex/regex.htm

 

2、w3cschool-判断电话号码

 https://www.w3cschool.cn/codecamp/validate-us-telephone-numbers.html

function telephoneCheck(str) {
// Good luck!
    var reg1 = /^1? ?[1-9]{1}\d{2}[- ]?\d{3}[- ]?\d{4}$/;
    var reg2 = /^1? ?\([1-9]{1}\d{2}\)[- ]?\d{3}[- ]?\d{4}$/;
    return (str.match(reg1) !== null ||str.match(reg2) !== null );
}
telephoneCheck("555-555-5555");
// true

 

posted on 2018-01-09 17:45  angle_qqs  阅读(153)  评论(0)    收藏  举报

导航