Regular Expressions
This section describes the following regular expression functions:
| Function | Description |
|---|---|
| REGEX_EXTRACT | Finds the first match of the regular expression pattern in string and returns the capturing group number requested |
| REGEXP_EXTRACT_ALL | Matches the regular expression on the input string. Returns the escape groups if any exist or the original string if none exists |
| REGEXP_LIKE | Evaluates the regular expression pattern and determines if it is contained within the string |
| REGEX_MATCH_POSITION | Matches the regular expression on the input string, and returns the index of the first match |
| REGEX_NAMED_GROUPS | Matches the regular expression on the input string. Returns record with field names and group names |
| REGEXP_REPLACE | Evaluates the regular expression pattern and replaces every instance found with the replacement |
Regular expression patterns
The regular expression patterns used when performing RegEx pattern matches are described in the table below:
| Expression | Contact | Description |
|---|---|---|
| Any character | . | Matches any single character except a line break. |
| Zero or more | * | Matches zero or more occurrences of the preceding expression, making all possible matches. |
| One or more | + | Matches at least one occurrence of the preceding expression. |
| Beginning of line | ^ | Anchors the match string to the beginning of a line. |
| End of line | $ | Anchors the match string to the end of a line. |
| Beginning of word | < | Matches only when a word begins at this point in the text. |
| End of word | > | Matches only when a word ends at this point in the text. |
| Line break | \n | Matches a platform-independent line break. In a Replace expression, inserts a line break. |
| Digits | \d | Matches any digit [0-9]. |
| Any one character in the set | [] | Matches any one of the characters within the []. To specify a range of characters, list the starting and ending character separated by a dash (-), as in [a-z]. |
| Matches any character not in the set of characters following the ^. | [^...] | Matches any character not in the set of characters following the ^. |
| Or | | | Matches either the expression before or the one after the OR symbol (|). Mostly used within a group. For example, (sponge|mud) bath matches "sponge bath" and "mud bath." |
| Tagged expression | {} | Matches text tagged with the enclosed expression. |
| /C++ Identifier | :i | Matches the expression ([a-zA-Z_$][a-zA-Z0-9_$]*). |
| Quoted string | :q | Matches the expression (("[^"]")|('[^']')). |
| Space or Tab | :b | Matches either space or tab characters. |
| Matches the expression ([0-9]+). | :z | Integer :z Matches the expression ([0-9]+). |