Skip to content

Instantly share code, notes, and snippets.

@rizafahmi
Created May 17, 2014 11:47
Show Gist options
  • 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 = "[email protected]"
"[email protected]"
iex(17)> [email, username, host] = Regex.run(~r/(\w+)@([\w.]+)/, str)
["[email protected]", "riza", "elixirdose.com"]
iex(18)> email
"[email protected]"
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