1. Home
  2. Docs
  3. ProfiMail
  4. Rules
  5. Regular expressions

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: www.regexpal.com

Quick reference to regex syntax

.Any character (except newline)
\.period (\ escapes also other characters such as: \* \( \\)
^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
(matches any character that is included in brackets)
[a-z]a through z (matches any character that is in given range of characters)
[^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 josh@example.com or from mary@example.com. 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 @example.com.

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


That means any word character occurring one or more time before text @example.com.

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