Skip to content

Instantly share code, notes, and snippets.

@hubsgz
Created March 5, 2014 02:19
Show Gist options
  • Save hubsgz/9359998 to your computer and use it in GitHub Desktop.
Save hubsgz/9359998 to your computer and use it in GitHub Desktop.
js 手机号, 电话号码验证
//判断是否手机号
function isMobile(v) {
var reg = /^1[3|4|5|8][0-9]{9}$/; //手机号
return reg.test(v);
}
//判断是否电话号码
function isTel(v) {
var reg=/^[+]{0,1}(\d){1,3}[ ]?([-]?((\d)|[ ]){1,12})+$/; //电话号码
return reg.test(v);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment