js 固话正则

var str = '82386012';
var partten = /(^(0\d{2})-(\d{8})$)|(^(0\d{3})-(\d{7})$)|(^(0\d{2})-(\d{8})-(\d+)$)|(^(0\d{3})-(\d{7})-(\d+)$)|(^\d{7}$)|(^\d{8}$)/;
if(partten.test(str)){
    return true;
}else{
    return false;
}

 

posted @ 2016-01-04 12:37  kravis  阅读(348)  评论(0编辑  收藏  举报