if (!document.form_name.input_name.value.match(/\([0-9]{3}\)\s[0-9]{3}\-[0-9]{2}\-[0-9]{2}/)) { alert('Error'); return false; }