Blog > Post

RegEx: How to Extract All Email Addresses from TXT Files or Strings

Friday, May 06, 2016

In this article, I will show you how to extract all email addresses from TXT Files or Strings using Regular Expression.

If you want to extract email addresses by using Regular Expression but don’t know how to write Regular Extraction, the article may help you with this.

Regular expression is very hard to learn if you don’t have any programming knowledge. In this article, I’ll introduce you a great Regular Expression tool to help you directly generate Regular Expressions and match all the email address quickly.

(Note: The steps of extracting email addresses from strings are the same.)


Regular Expression to Match Email Addresses from TXT Files or Strings

1. Use the following Regular Expression to match a list of all email addresses from the targeted .txt files.



2. An example of  .txt file :


This email address is valid: and this email address is not valid web@email.

Same as is a valid email address and address test@test. is not valid !\


3.     a. Launch Octoparse and open the RegEx Tool.

        b. Copy and paste your text files in the “Source Text” box and [a-z0-9-]{1,30}@[a-z0-9-]{1,65}.[a-z]{1,} in  “Regular Expression” box.

        c. Choose “Match All” option at the bottom, and click “Match”.

Now it’s done. All the matched email addresses are listed in the green box.






Author: The Octoparse Team




Download Octoparse Today



For more information about Octoparse, please click here.

Sign up today.



Author's Picks


About Octoparse

A Comparison among Three Editions of Octoparse

Octoparse 6.0 is Now Available

What A Price Monitor Can Help you?

Collect Data from Amazon

Collect Data from eBay

Collect Data from LinkedIn

Collect Data from




Download Octoparse to start web scraping or contact us for any
question about web scraping!

Contact Us Download