PageRenderTime 47ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/nlw/share/skin/s3/javascript/email.js

https://github.com/rbertolette/socialtext
JavaScript | 19 lines | 12 code | 1 blank | 6 comment | 0 complexity | f32ff0fdaec8b16f8d8c99574ad15080 MD5 | raw file
Possible License(s): LGPL-2.1, AGPL-1.0, MPL-2.0-no-copyleft-exception, CC0-1.0
  1. // Regular expression for validating email addresses. Not perfect,
  2. // but close enough to eliminate the majority of invalid addresses,
  3. // which erring on the side of caution. Adapted from here:
  4. //
  5. // http://fightingforalostcause.net/misc/2006/compare-email-regex.php
  6. //
  7. var EMAIL_ADDRESS_REGEX = new RegExp(
  8. "^"
  9. + "([a-zA-Z0-9_'+*$%\\^&!\\.\\-])+"
  10. + "@"
  11. + "(([a-zA-Z0-9\\-])+\\.)+"
  12. + "([a-zA-Z0-9:]{2,4})+"
  13. + "$"
  14. , "i"
  15. );
  16. function email_page_check_address(email_address) {
  17. return EMAIL_ADDRESS_REGEX.test(email_address);
  18. }