/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function validatEmail(txt_msg) { var pattern = /[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}/g; return(pattern.test(txt_msg)); } function validatMobile(txt_msg) { var testPattern = /[0-9]{10,11}/; return( testPattern.test(txt_msg)); } function validateSpecialCharacters(txt_msg) { var testPattern = /[-[\]{}()*+?.,\\^$|#\s]/; return( testPattern.test(txt_msg)); }
URL: http://simonwillison.net/2006/Jan/20/escape/