Regular Expressions¶
The following tables provide a overview of the regular expressions syntax. See also Python regular expressions description in the Python re module.
Special Characters |
Description |
---|---|
|
Matches any character (dot). |
|
“^…”, matches start-of-string (caret). |
|
“…$”, matches end-of-string (dollar sign). |
|
“A|B”, matches “A” or “B”. |
|
Escape character. |
|
EXAMPLE: Matches character ‘.’ (dot). |
|
EXAMPLE: Matches character ‘ |
To select or match characters from a special set of characters, a character set must be defined.
Character sets |
Description |
---|---|
|
Define a character set, like |
|
Matches digit character: [0-9] |
|
Matches non-digit character. |
|
Matches whitespace character: |
|
Matches non-whitespace character |
|
Matches alphanumeric character: |
|
Matches non-alphanumeric character. |
A text part must be group to extract it as part (parameter).
Grouping |
Description |
---|---|
|
Group a regular expression pattern (anonymous group). |
|
Matches text of earlier group by index, like: “ |
|
Matches pattern and stores it in parameter “name”. |
|
Match whatever text was matched by earlier group “name”. |
|
Matches pattern, but does non capture any text. |
|
Matches not-pattern: Ignores anything with this pattern. |
|
Comment (is ignored), describes pattern details. |
If a group, character or character set should be repeated several times, it is necessary to specify the cardinality of the regular expression pattern.
Cardinality |
Description |
---|---|
|
Pattern with cardinality 0..1: optional part (question mark). |
|
Pattern with cardinality zero or more, 0.. (asterisk). |
|
Pattern with cardinality one or more, 1.. (plus sign). |
|
Matches |
|
Matches from |
|
EXAMPLE: Matches one or more alphabetical characters. |