How to use a regular expression for email parsing

See also:
Capturing text with Regular Expressions
Online regex tester and debugger (
Exporting to Excel

Download this example

exporting email data to an excel file

This example shows how to use regular expressions (a very basic ones) to capture text from an incoming email. It also exports the resulting text to an excel file.

The email we receive is like the following:

Subject: Weather report
Temperature: 22.1
Pressure: 1032.6 hPa

Temperature: 22.3
Pressure: 1032.9 hPa

Temperature: 21.7
Pressure: 1033.1 hPa

Temperature: 20.8
Pressure: 1033.4 hPa

In order to capture the temperature and pressure values we configure the fields this way:

The regular expressions used are:



They are quite similar. Let’s separate the one that captures the temperature in two parts. Their meaning is as follows:

Regular expression part Meaning
Temperature:\s+ The word ‘Temperature’ followed by ‘:’ and then followed by one or multiple spaces
(?’temperature’.*) The field called ‘temperature’ is any string of consecutive characters.

Finally, when an email like this is received Email Parser produces this output and exports to Excel:

© 2008-2024 Triple Click Software
News & Updates

Windows App privacy police and terms of use
Web App privacy police and terms of use

This site privacy police and terms of use
PAD file·Old news