Skip to content

Regular expression

This article describes regular expressions in email processing rules when extracting data from an email. In the REGEXPFIND and REGEXPREPLACE functions, the result depends on the function itself — see the article for the relevant function.

Regular expressions in rules for processing emails allow you to isolate a desired fragment of text when extracting data from an email.

Important

  • Using regular expressions requires programming skills. If you don't have these skills, we recommend asking someone who does for help.
  • In Planfix, regular expressions operate with the Pattern.DOTALL and Pattern.MULTILINE options. In the online validator, select gms.
  • Regular expressions can also be used with the REGEXPFIND and REGEXPREPLACE functions.

Formatting regular expressions

Planfix uses the regular expression format used in Java. The syntax of regular expressions uses the symbols <([{\^-=$!|]})?*+.>, which can be combined with letters to create metacharacters. The most frequently used metacharacters are listed in this table:

Metacharacter Meaning
^ beginning of a line
$ end of a line
\d digit
\D non-digit character
\s space character
\S non-space character
\w alphanumeric character or underscore
\W any character except alphanumerics and underscores
. any character
\t tab character
\n newline character
\r carriage return character
[abc] any of the characters listed (a, b, or c)
[^abc] any character except those listed (not a, b, or c)
[a-zA-Z] combined ranges (Latin characters from a to z, case-insensitive)
[a-d[m-p]] union of characters (from a to d and from m to p)
[a-z&&[def]] intersection of characters (d, e, f)
[a-z&&[^bc]] subtraction of characters (a, d-z)
 ? one or none
* zero or more times
+ one or more times
{n} n times
{n,} n or more times
{n,m} at least n times and no more than m times

Helpful information

  • In email processing rules, only the first capturing group is returned. Enclose the text you want returned in parentheses, and make any other groups non-capturing — (?:...). This applies only when extracting data from an email. The REGEXPREPLACE function replaces the entire match.
  • You can read more about regular expressions in this article.


Go To