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 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.
Pretty straightforward – but see below a full example using this clever regexp from a Stackoverflow.com discussion on “
Extract email from text using notepad++ and regexp”, and with further inspiration from a superuser.com discussion “ How to delete all lines in Notepad++ except lines containing a word I need?”.
Starting with your file – in that example, an extraction of the “TO” addresses of an Outlook 2013 sent emails folder – you might have a lot of strange characters, unnecessary text, email addresses on the same line, …
First step is to open the Replace option, Search => Replace or Ctrl+H .
Here, in Find what, enter below
In Replace with, enter this to replace each email address by : line break \n + search string $1 + line break \n
Make sure to check the
regular expression radio button, and click Replace All.
See the result – each email address is now alone on a new line.
Next step is to identify all these lines containing only a single email address. Open the Marktab in the Search window. Copy the same regexp as before to identify the email addresses. Make sure the
regular expression is checked, along with the Bookmark line option, and start the marking operation with Mark All
In the file, all lines containing email addresses are now bookmarked.
In Search => Bookmark, select the Remove Unbookmarked Lines
And voilà ! Your file now only contains the email addresses without unnecessary text.
As a last step, you might want to
remove duplicates to have a list of unique email addresses.
To extract emails from a text file, open it using
Notepad++ text editor, and apply the instructions above, by using a regular expression, tagging all emails, selecting only the emails, and copying them.
To copy all regex matches, use the Marktab in Notepad++ search window. By putting here the regexp, all results matching the regexp will be marked, and can be selected and copied that way.
Remove duplicates in notepad++
To remove the HTML tags in Notepad++ from a text, use below
regular expression <.*?>|</.*?>, and replace for example with a space. Make sure that the regular expression check box in the search form has been selected.
In the replace menu, accessible with shortcut CTRL+H, use the following regexp, with the
regular expression and dot matches new line checked:
And use this replace string in order to get a list of all URLs extracted in the file:
How to copy marked lines in NotePad++ ?
Marked text in Notepad++ can be copied using a regex search, by using the search > mark menu, selecting bookmark line and clicking mark all.
Then, use the search > bookmark > copy bookmarked lines menu, and the result can be pasted in a new file, containing the copy of marked lines.
How to extract emails from text in a few clicks?
To extract emails from text, simply enter a
regular expression to find out all the email addresses in a text file, for example an extraction of all your contacts from Microsoft Outlook.
Then, identify the email addresses, and remove the extra lines. Using NotePad++, it can easily be done by following our guide.
extract email address from Notepad++ using regex
The email addresses in a CSV, such as a MicrosoftOutlook export, works exactly the same as for a standard text file.
extract emails from CSV file, start by opening the CSV file with Notepad++ text editor, distinguish the single email addresses with the process explained above, and copy them.
extract emails from CSV file follow the following process:
Open the CSV file with
Notepad++ text editor,
regular expression matching potential email addresses,
Replace them with email and line break,
regular expression to bookmark effective email addresses,
Remove lines unbookmarked that don’t contain email addresses,
Get a final list by performing a
remove duplicates operation that will clean your file and have the emails extracted from your CSV file and ready to export.
extract emails from CSV file process has been completed using a regular expression, you will be able to copy them directly from the results. VIDEO
Irene Page, 2018-08-19
Simple, clair et bien expliqué, merci beaucoup
Lee Ryan, 2018-08-19
No sabía acerca de estos detalles, por favor haga más
Raymond Mcbride, 2018-08-19
O poveste grozavă, mulțumesc pentru schimbul
Kathryn Baker, 2018-08-19
Thank you, author, was very useful for me
George Mauricio Santana Lima, 2019-01-16
THIS TUTORIAL IS AMAZING, SUCH AN USEFUL GUIDE! <3
Thank you! This came handy!