Created
May 22, 2013 05:47
-
-
Save marvinahv/5625497 to your computer and use it in GitHub Desktop.
Check if String is a valid email address
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class String | |
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i | |
def is_valid_email? | |
if self.match(VALID_EMAIL_REGEX) | |
return true | |
else | |
return false | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment