Regular Expressions
Die Suchargumente für die Funktionen RegExQuery und RefExQueryByType der Klassen CX_OBJECT_DICTIONARY, CX_OBJECT_DICTIONARY_CI, CX_OBJECT_DICTIONARY_ML und CX_OBJECT_DICTIONARY_ML_CI werden als Regular Expressions interpretiert.
Regular expressions are made up of normal characters and metacharacters. Normal characters include upper and lower case letters and digits. The metacharacters have special meanings and are described in detail below.
In the simplest case, a regular expression looks like a standard search string. For example, the regular expression "testing" contains no metacharacters. It will match "testing" and "123testing" but it will not match "Testing".
To really make good use of regular expressions it is critical to understand metacharacters. The table below lists metacharacters and a short explanation of their meaning.
Metacharacter | Description |
---|---|
. |
Matches any single character. For example the regular expression r.t would match the strings rat, rut, r t, but not root. |
$ |
Matches the end of a line. For example, the regular expression weasel$ would match the end of the string "He's a weasel" but not the string "They are a bunch of weasels." |
|
|
* |
Matches zero or more occurences of the character immediately preceding. For example, the regular expression .* means match any number of any characters. |
\ |
This is the quoting character, use it to treat the following character as an ordinary character. For example, \$ is used to match the dollar sign character ($) rather than the end of a line. Similarly, the expression \. is used to match the period character rather than any single character. |
|
|
\< \> |
Matches the beginning (\<) or end (\>) or a word. For example, \ |
\( \) |
Treat the expression between \( and \) as a group. Also, saves the characters matched by the expression into temporary holding areas. Up to nine pattern matches can be saved in a single regular expression. They can be referenced as \1 through \9. |
| |
Or two conditions together. For example (him|her) matches the line "it belongs to him" and matches the line "it belongs to her" but does not match the line "it belongs to them." NOTE: this metacharacter is not supported by all applications. |
+ |
Matches one or more occurences of the character or regular expression immediately preceding. For example, the regular expression 9+ matches 9, 99, 999. NOTE: this metacharacter is not supported by all applications. |
? |
Matches 0 or 1 occurence of the character or regular expression immediately preceding.NOTE: this metacharacter is not supported by all applications. |
|
|