I am trying to extract information from an email address, for example in ruby:
Email: Joe Schmo <joeschmo@abc123.com>
to get these three variables:
name = ?
email = ?
domain = ?
I tried searching everywhere, but cannot find how to do it right. Here is what I still have:
the_email_line = "Email: Joe Schmo <joeschmo@abc123.com>"
name = (/^Email\: (.+) <(.+)>@[A-Z0-9.-]+\.(.+)/).match(the_email_line)[1]
email = (/^Email\: (.+) <(.+)>@[A-Z0-9.-]+\.(.+)/).match(the_email_line)[2]
domain = (/^Email\: (.+) <(.+)>@[A-Z0-9.-]+\.(.+)/).match(the_email_line)[3]
Any idea on how to get these three variables correctly?
source
share