In Notepad++, I am looking to do a regex that replaces this:
Joe Schmoe <joe.schmoe@gmail.com>
with
joe.schmoe@gmail.com
I would've thought that:
^(.*) \<(.*?)\>$
would've put the required value into "\2
". However, Notepad++ reports that it finds no matches.
Your problem comes from \<
and \>
than stand for word boundary. Do not escape these characters if you want to match <
and >
.
^.+?<(.+?)>
$1
. matches newline
Explanation:
^ # beginning of line
.+? # 1 or more any character but newline, not greedy
< # literally
(.+?) # group 1, 1 or more any character but newline, not greedy
> # literally
Screenshot (before):
Screenshot (after):
Be aware that will not work for email like "very.(),:;<>[]\".VERY.\"very@\\ \"very\".unusual"@strange.example.com