I have an email field that may be formatted in a few different ways.
hello@world.com
"hello world" <hello@world.com>
hello world <hello@world.com>
I would like to capture both the hello world string (if it's there) and the email address (if it's there). I have a regular expression that almost works, but it doesn't quite.
sed -r 's/"?([^"]+)*"?\s<?([^>]+@[^>]+)>?/["\1","\2"]/' <<< 'Hello World <helloworld@gmail.com>'
Please help?