Copy code The code is as follows: Regular expression validation <br> var Validate = {<br> isTel: function (s) { var patrn = /^(( ?86)|(( 86)))?d{3,4}-d{7,8}(-d{3, 4})?$/<p> if (!patrn.exec(s)) return false<br> return true<br> },<br> <br> 🎜> },</p> <p> cellPhone: function () {<br> var cellPhoneNumber = $("#txtCellPhone").val();<br> if (!Validate.isMobile(cellPhoneNumber)) {<br> alert("Mobile number format Incorrect");</p> ; 🎜> },<p> <br> telePhone: function () {<br> var telePhoneNumber = $("#txttelePhone").val();<br> if (!Validate.isTel(telePhoneNumber)) {<br> alert("Telephone number format Incorrect");<br> ; 🎜> ;/script><br></head><br><body><br><div></p> type="text" id="txtCellPhone" /><input type="button" value="Validation" onclick="Validate.cellPhone();"/><br /><p> < label>Please enter your phone number (supports 86):</label><input type="text" id="txttelePhone" /><input type="button" value="Validate" onclick="Validate. telePhone();"/><br /><br></div><br></body><br></html><br><br><br></p> </div>