Skip to content

Instantly share code, notes, and snippets.

@rizafahmi
Created May 17, 2014 11:47
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rizafahmi/b1711f7f10aaf7a7ced9 to your computer and use it in GitHub Desktop.
Save rizafahmi/b1711f7f10aaf7a7ced9 to your computer and use it in GitHub Desktop.
iex(16)> str = "riza@elixirdose.com"
"riza@elixirdose.com"
iex(17)> [email, username, host] = Regex.run(~r/(\w+)@([\w.]+)/, str)
["riza@elixirdose.com", "riza", "elixirdose.com"]
iex(18)> email
"riza@elixirdose.com"
iex(19)> username
"riza"
iex(20)> host
"elixirdose.com"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment