Guest User

Untitled

a guest
Aug 28th, 2018
528
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. Regex for multiline email addresses?
  2. johnsmith@email.com - ok
  3.  
  4. johnsmith@email.com
  5. karensmith@emailcom - ok
  6.  
  7. john smith@email.com - not ok
  8. karensmith@emailcom
  9.  
  10. ((w+([-+.']w+)*@w+([-.]w+)*.w+([-.]w+)*(rn)?)+)r*
  11.  
  12. ^(((w+([-+.']w+)*@w+([-.]w+)*.w+([-.]w+)*(rn)?s?)+)*)$
  13.  
  14. /Aw+@w+.w+(nw+@w+..w+)*z/
  15.  
  16. "test@here.plnthe@bar.pl".match(/Aw+@w+.w+(nw+@w+.w+)*z/)
  17. => #<MatchData "test@here.plnthe@bar.pl" 1:"nthe@bar.pl">
  18. "test@here.plnthebar.pl".match(/Aw+@w+.w+(nw+@w+.w+)*z/)
  19. => nil
  20. "test@here.pl".match(/Aw+@w+.w+(nw+@w+.w+)*z/)
  21. => #<MatchData "test@here.pl" 1:nil>
  22. "test@here".match(/Aw+@w+.w+(nw+@w+.w+)*z/)
  23. => nil
Add Comment
Please, Sign In to add comment