extract email address
I have a huge list of email addresses in this format:
And I want just have the emails listed in one row like this:
Assuming very well-formed data like you show, I’d start by trying:
Find what zone:
(?-s).+?, .+? (.+?);<-----note the trailing space
Replace with zone:
\1\r\n<------- assumes you want Windows line-endings
Search mode: Regular expression
it seems the list was not displayed correctly…
The arrow brackets were not shown. Here it is how it looks like (I had to add an space after the @ symbol to get it displayed)
name1, surname1 <surname1.name1@ email.com>; name2, surname2 <surname2.name2@ email.com>; …
For future refernce, if you indent the line by 4 spaces in your post (with blank lines before and after), it will show up unformatted here, so the forum won’t mess with it. Or you could put it between back ticks, like `my <data@here>`, which will render as
So, do you have anything else in this file that needs to stay, or do you really just want everything that is within angle brackets to be put one per line? For that, I’d use something like:
- regular expression
Nobody looks at the PREVIEW pane before hitting Submit to make sure their data is correct. Sigh.
BTW, changing the data so it displays “correctly” changes the problem!
this worked perfect!
I’m glad it’s working for you.
If you are going to be doing more regular expression manipulation of your text files (including if you ever just want to tweak this regex in order to make some change, like only doing ones that have semicolon’s after the > or something), you are going to want to study regex yourself.
We have a FAQ entry which explains where to find regex docs, which is a good starting point for learning about them. I’d recommend searching through some of those, and seeing if you can understand everything in the regex I gave. After reading the docs, if you’re having trouble understanding a portion of it, feel free to ask, and we can help clarify.
If you come back for future requests for regex help: please craft your own expression… and if it doesn’t work, then you can ask us, including: show what you tried, explain why you tried that (ie, what you think the regex should do, and what you think each piece of the regex is doing), and show what results you get that doesn’t match your expectations. This will help us to help you better.
(And the post “How to Markdown code on this Forum” will help you format posts, so the data exactly represents your actual data.)