if (! (/^1[3,5,6,7,8,9]\d{9}$/). Test (E.detail.value.data_phone)) { Wx.showtoast ({ ' Please enter a valid 11-digit mobile number! ') , }) Else if (! (/(^\d{15}$) | (^\d{17} ([0-9]| X|X) ($)/. Test (E.detail.value.data_idcard))) { Wx.showtoast ( {' ID number must be a 18-bit second-generation ID card! ') , }) } Else if (! (/^ ([a-za-z0-9_-]) [email protected] ([a-za-z0-9_-]) + (. [ A-za-z0-9_-]) (+$)/. Test (E.detail.value.data_email))) { Wx.showtoast ( {' Please enter the correct email address ', }) }
Explanation of the test function of JS regular expression
The return value of the method is a Boolean value that can match the result of hermetical expression in the string, if there is a match, return ture, if there is no match return false, this method is often used to judge the legality of user input data, such as verifying the legality of email
jquery Regular: Phone, id, email simple check