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; }