Skip to content

Instantly share code, notes, and snippets.

@marvinahv
Created May 22, 2013 05:47
Show Gist options
  • Save marvinahv/5625497 to your computer and use it in GitHub Desktop.
Save marvinahv/5625497 to your computer and use it in GitHub Desktop.
Check if String is a valid email address
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