Regular expression: Difference between revisions
From Planfix
No edit summary |
No edit summary |
||
(13 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
Regular expressions in rules for processing emails allow you to isolate a desired fragment of text when extracting data from an email. | {{#seo: | ||
|title=Regular expression in Planfix | |||
|titlemode=append | |||
|keywords=planfix, regular expression, rules, email, task, extracting data from the email | |||
|description=Using regular expressions in Planfix | |||
}} | |||
'''Regular expressions''' in [[Rules for creating tasks by email | rules for processing emails]] allow you to isolate a desired fragment of text when [[Email rules: Extracting data | extracting data]] from an email. | |||
== Important == | == Important == | ||
*The use of regular expressions typically requires programming skills. If you don't know any programming languages, you should ask for help. | *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 [https://regex101.com/online validator] — [https://p.pfx.so/pf/nG/2iUOoF.png 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: | |||
{| class="wikitable" style="text-align: center;" | {| class="wikitable" style="text-align: center;" | ||
|- | |- | ||
! | ! Metacharacter !! Meaning | ||
|- | |- | ||
| <nowiki> ^ </nowiki> || | | <nowiki> ^ </nowiki> || beginning of input | ||
|- | |- | ||
| <nowiki> $ </nowiki> || | | <nowiki> $ </nowiki> || end of input | ||
|- | |- | ||
| <nowiki> \d </nowiki> || | | <nowiki> \d </nowiki> || digit | ||
|- | |- | ||
| <nowiki> \D </nowiki> || | | <nowiki> \D </nowiki> || non-digit character | ||
|- | |- | ||
| <nowiki> \s </nowiki> || | | <nowiki> \s </nowiki> || space character | ||
|- | |- | ||
| <nowiki> \S </nowiki> || | | <nowiki> \S </nowiki> || non-space character | ||
|- | |- | ||
| <nowiki> \w </nowiki> || | | <nowiki> \w </nowiki> || alphanumeric character or underscore | ||
|- | |- | ||
| <nowiki> \W </nowiki> || | | <nowiki> \W </nowiki> || any character except alphanumerics and underscores | ||
|- | |- | ||
| <nowiki> . </nowiki> || | | <nowiki> . </nowiki> || any character | ||
|- | |- | ||
| <nowiki> \t </nowiki> || | | <nowiki> \t </nowiki> || tab character | ||
|- | |- | ||
| <nowiki> \n </nowiki> || | | <nowiki> \n </nowiki> || newline symbol | ||
|- | |- | ||
| <nowiki> \r </nowiki> || | | <nowiki> \r </nowiki> || carriage return symbol | ||
|- | |- | ||
| <nowiki> [ | | <nowiki> [abc] </nowiki> || any of the characters listed (a, b, or c) | ||
|- | |- | ||
| <nowiki> [^ | | <nowiki> [^abc] </nowiki> || any character except those listed (not a, b, or c) | ||
|- | |- | ||
| <nowiki> [a-zA-Z] </nowiki> || | | <nowiki> [a-zA-Z] </nowiki> || multiple ranges (Latin characters from A to Z, case-insensitive) | ||
|- | |- | ||
| <nowiki> [a-d[m-p]] </nowiki> || | | <nowiki> [a-d[m-p]] </nowiki> || combining characters (from a to d and from m to p) | ||
|- | |- | ||
| <nowiki> [a-z&&[def]] </nowiki> || | | <nowiki> [a-z&&[def]] </nowiki> || overlapping characters (d, e, f) | ||
|- | |- | ||
| <nowiki> [a-z&&[^bc]] </nowiki> || | | <nowiki> [a-z&&[^bc]] </nowiki> || subtracting characters (a, d-z) | ||
|- | |- | ||
| <nowiki> ? </nowiki> || | | <nowiki> ? </nowiki> || one or not exist | ||
|- | |- | ||
| <nowiki> * </nowiki> || | | <nowiki> * </nowiki> || match zero or one | ||
|- | |- | ||
| <nowiki> + </nowiki> || | | <nowiki> + </nowiki> || one or more times | ||
|- | |- | ||
| <nowiki> {n} </nowiki> || n | | <nowiki> {n} </nowiki> || n times | ||
|- | |- | ||
| <nowiki> {n,} </nowiki> || n | | <nowiki> {n,} </nowiki> || n or more times | ||
|- | |- | ||
| <nowiki> {n,m} </nowiki> || | | <nowiki> {n,m} </nowiki> || 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 '''(?:)''' | |||
== | |||
* | |||
Line 74: | Line 73: | ||
*[[Creating and editing rules]] | *[[Creating and editing rules]] | ||
*[[Rules for creating tasks by email]] | *[[Rules for creating tasks by email]] | ||
Latest revision as of 08:20, 28 October 2024
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 (?:)