Guest User

Untitled

a guest
Oct 16th, 2017
396
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. def is_a_valid_email?(email)
  2. (email =~ /^(([A-Za-z0-9]*.+*_+)|([A-Za-z0-9]+-+)|([A-Za-z0-9]++)|([A-Za-z0-9]++))*[A-Zā€Œā€‹a-z0-9]+@{1}((w+-+)|(w+.))*w{1,63}.[a-zA-Z]{2,4}$/i)
  3. end
  4.  
  5. hello.me_1@email.com # <~~ valid
  6. foo.bar#gmail.co.uk # <~~~valid
  7. f.o.o.b.a.r@gmail.com # <~~~valid
  8. f...bar@gmail.com # <~~ not valid
  9. get_at_m.e@gmail #<~~ valid
  10.  
  11. VALID_EMAIL_REGEX = /A[w+-.]+@[a-zd-]+(.[a-zd-]+)*.[a-z]+z/i
  12.  
  13. VALID_EMAIL_REGEX = /A[w+-.]+@[a-zd-]+(.[a-z]+)*.[a-z]+z/i
  14.  
  15. VALID_EMAIL_REGEX = /A([w+-].?)+@[a-zd-]+(.[a-z]+)*.[a-z]+z/i
  16.  
  17. VALID_EMAIL_REGEX = /A[w+-.]+@[a-zd-]+(.[a-zd-]+)*.[a-z]+z/i
  18.  
  19. `! $ & * - = ` ^ | ~ # % ' + / ? _ { }`
  20.  
  21. /A[^@s]+@[^@s]+z/
  22.  
  23. ".....@a....",
  24. "david.gilbertson@SOME+THING-ODD!!.com",
  25. "a.b@example,com",
  26. "a.b@example,co.de"
  27.  
  28. VALID_EMAIL_REGEX = /A[w+-.]+@[a-zd-]+(.[a-zd-]+)*.[a-z]+z/i
  29.  
  30. > 'some@email.with-subdomain.com' =~ VALID_EMAIL_REGEX
  31. => 0
  32.  
  33. if email.match?('[a-z0-9]+[_a-z0-9.-]*[a-z0-9]+@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,4})')
  34. puts 'matches!'
  35. else
  36. puts 'it doesn't match!'
  37. end
  38.  
  39. /A[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*z/
Add Comment
Please, Sign In to add comment