Posted By

erraja_07 on 06/02/11


Tagged

javascript test match


Versions (?)

Javascript Match email , phone number and special characters from a String(textarea)


 / Published in: JavaScript
 

URL: http://simonwillison.net/2006/Jan/20/escape/

  1. function validatEmail(txt_msg)
  2. {
  3. var pattern = /[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}/g;
  4. return(pattern.test(txt_msg));
  5. }
  6.  
  7. function validatMobile(txt_msg)
  8. {
  9. var testPattern = /[0-9]{10,11}/;
  10. return( testPattern.test(txt_msg));
  11. }
  12.  
  13. function validateSpecialCharacters(txt_msg)
  14. {
  15. var testPattern = /[-[\]{}()*+?.,\\^$|#\s]/;
  16. return( testPattern.test(txt_msg));
  17. }

Report this snippet  

You need to login to post a comment.