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

  

posted on 2016-12-22 18:13  梦如影  阅读(161)  评论(0编辑  收藏  举报