User Tools

Site Tools


Regular expressions

What are regular expressions? In short, this is syntax for flexible matching of text (searching elements inside of text) by writing a formula with wild-cards and patterns.

Learn more here: Regex

What are Regular expressions good for in ProfiMail? They may be used in Rules for writing Rule condition to match text (for example in message subject or header).

Here is good online regex tester for playing with:

Quick reference to regex syntax

.Any character 1)
\.period 2)
^start of string
$end of string
\d, \w, \sdigit, word character [A-Za-z0-9_], or whitespace
\D, \W, \Sanything except digit, word character, or whitespace
[abc]character a, b, or c 3)
[a-z]a through z 4)
[^abc]any character except a, b, or c
aa|bbeither aa or bb
?zero or one of preceding element
*zero or more of preceding element
+one or more of preceding element
{n}exactly n times of preceding element
{n,}n or more times of preceding element
{m,n}between m and n times of preceding element
??, *?, +?, {n}?same as above, but as few as possible
(expr)capture expr for use with \1, etc
(?:expr)non-capturing group
(?=expr)followed by expr
(?!expr)not followed by expr

Simple example

For example, you may want to create a Rule to find messages sent from or from You could write separate Rule condition with all possible email addresses to search for, or you can use regular expression:


Which means to search for text that begins with josh OR mary followed by

To extend the example, here is formula to match any email address from domain:


That means any word character occurring one or more time before text

For the rest, you can make your own tests in this online tester, or try this in Rules.

1) except newline
2) \ escapes also other characters such as: \* \( \\
3) matches any character that is included in brackets
4) matches any character that is in given range of characters
profimail/regex.txt · Last modified: 2013/03/05 14:13 (external edit)