Your Ad Here

Posted By

erotte on 02/08/08


Tagged

textmate


Versions (?)

tags


 / Published in: Other
 

  1.  
  2. # configuration.rb
  3. EMAIL_VALIDATION_REGEXP = /A([^@s]+)@((?:[-a-zA-Z0-9]+.)+[a-zA-Z0-9]{2,})Z/i
  4.  
  5.  
  6. class String
  7. def valid_email?
  8. EMAIL_VALIDATION_REGEXP === self
  9. end
  10. end
  11.  
  12. class NilClass
  13. def valid_email?
  14. false
  15. end
  16. end
  17.  
  18.  
  19. # "email@domain.tld -> true"

Report this snippet  

You need to login to post a comment.