Having a file, for example, an extraction from your mailbox, and you want to extract only the email addresses? Using Notepad++ and simple regular expression, that’s pretty simple. See below a full example, or, to summarize, open your file, use the below regexp to find email addresses, add line breaks before and after each of them, and then mark the lines containing an email address and delete the unmarked lines.
Given the following text file as input, there are 3 easy steps to follow so that you can extract all email addresses contained inside the text.
Text containing email addresses
Table of Contents
1st Step – Find Email Addresses Using Regex Match:
Use the find & replace feature of notepad++
Find:(\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}\b)
Replace:\r\n$&\r\n
This adds and new line before and after each email address as shown below.
Email address in a new line
Step 2 – Mark Email Addresses And Bookmark Lines
Mark:(\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}\b)
have “Bookmark Line” checked.
Step 3 – Remove Unmarked Lines
Search > Bookmark > Remove Unmarked Lines
Remove unmarked lines in Notepad++
Final Words:
That’s all we have. We hope that you liked this article. If you have any problem with this code while using then feel free to contact us with a full explanation of your problem. We will reply to you as time allows us or If you have any doubts and problems please comment below. We are happy to help you! If you liked this article, Don’t forget to share this with your friends so they can also take benefit from it and leave your precious feedback in our comment form below. Happy development, See you in the next article.
thats a great post!
Welcome here and thanks for reading our article and sharing your view.
This worked perfectly and saved me a lot of time!
Thank you very much 🙂
Welcome here and thanks for reading our article and sharing your view. This will be very helpful to us to let us motivate to provide you with more awesome and valuable content from a different mind. Thanks again.