I have a comma-delimited list of email addresses with each actual address prepended by the contact's name (from Gmail). Here's an example:
Fred Flintstone <[email protected]>, Wilma Flintstone <[email protected]>, Barney Rubble <[email protected]>, Bamm-Bamm Rubble <[email protected]>,
converts to:
[email protected], [email protected], [email protected], [email protected],
Background info: I am trying to paste the list of contacts into a webex invite, which can only accept email addresses.
Remove everything except regex match in Vim is related, but all the email addresses are on one line in this case.
Have you tried?
:s/.\{-}\%(\(,\s*\)\|<\(.\{-}\)>\)/\1\2/g
The following will also work:
:s/.*/\=join(map(split(submatch(0), ','), "matchstr(v:val, '<\\zs.*\\ze>')"), ', ')