Skip to content

Instantly share code, notes, and snippets.

@drippdropp
Created August 28, 2014 18:01
Show Gist options
  • Save drippdropp/dafa128bfd4a9c5f0144 to your computer and use it in GitHub Desktop.
Save drippdropp/dafa128bfd4a9c5f0144 to your computer and use it in GitHub Desktop.
Basic Email Validation Method!
def extract_emails_from_string(string)
email_validation_regex =
Regexp.new(/([a-z0-9A-Z\+\_\.\'\!\#\$\%\&\~\{\}\|\-]+\@[a-z0-9A-Z\+\_\.\'\!\#\$\%\&\~\{\}\|\-]+)/i)
string.scan(email_validation_regex).flatten.join(', ')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment