var phoneReg = /^1[3-578]d{9}$/; function isPhoneAvailable(phonevalue){ if(phoneReg.test(phonevalue)){ return true; }else{ return false; } }