1.XXX-XXX-XXXX
2.XXXXXXXXXX
I would like to know the regular expression of the format. Modifying the existing sources will yield results.
var regExp = /^01([016789]?)-([0-9]{3})-([0-9]{4})$/;
var regExp = /^01([016789]?)[0-9]{3}[0-9]{4}$/;
A statement to check the condition. I wonder if the contact form is also correct. var test is a text field that receives input.
if(!regExp.text) {
        alert(""phone number format is not valid.");
        document.getElementById('phone').focus();
        return ;
    }
 
    