Regular expression
From Planfix
Regular expressions in rules for processing emails allow you to isolate a desired fragment of text when extracting data from an email.
Important
- The use of regular expressions typically requires programming skills. If you don't know any programming languages, you should ask for help.
- In Planfix, regular expressions operate with the Pattern.DOTALL and Pattern.MULTILINE options. For validation, you can use the validator — gms
- Regular expressions can also be used with the REGEXPFIND function.
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 input |
$ | end of input |
\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 symbol |
\r | carriage return symbol |
[abc] | any of the characters listed (a, b, or c) |
[^abc] | any character except those listed (not a, b, or c) |
[a-zA-Z] | multiple ranges (Latin characters from A to Z, case-insensitive) |
[a-d[m-p]] | combining characters (from a to d and from m to p) |
[a-z&&[def]] | overlapping characters (d, e, f) |
[a-z&&[^bc]] | subtracting characters (a, d-z) |
? | one or not exist |
* | match zero or one |
+ | 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
- The result of text processing using a regular expression becomes the first capturing group. Accordingly, what is needed in the result should be enclosed in parentheses, and the rest of the groups should be made non-capturing (?:)