Searches for a pattern of characters within a string as specified by a limited set of regular expressions. If this node finds a match, it splits the input string into three substrings: the string that appears before the match, the match itself, and the string that appears after the match.
Match Pattern gives you fewer options for matching strings but performs more quickly than Match Regular Expression. For example, Match Pattern does not support the parenthesis or vertical bar (|) characters.
The input string to search.
The pattern for which you want to search in string. regular expression is limited to the following regular expression characters: . (period), *, +, ?, [], ^, $, \, \b, \f, \n, \s, \r, \t, and \xx. Furthermore, this input does not support character grouping, alternate pattern matching, backreferences, or non-greedy quantification.
For more complex pattern matching, use Match Regular Expression.
Definitions of Special Characters
What Happens When There Is No Match?
If the node does not find regular expression, match substring is empty, before substring is the entire string, after substring is empty, and offset past match is -1. Match Pattern is compatible with a limited set of regular expressions and does not support character grouping, alternate pattern matching, backreferences, or non-greedy quantification. You can use a specific set of special characters to refine the search.
Examples of Allowable Regular Expressions
Characters to Find | Regular Expression |
---|---|
All uppercase and lowercase versions of volts, that is, VOLTS, Volts, volts, and so on | [Vv][Oo][Ll][Tt][Ss] |
A plus sign or a minus sign | [+-] |
A sequence of one or more digits | [0-9]+ |
Zero or more spaces | \s* or * (that is, a space followed by an asterisk) |
One or more spaces, tabs, new lines, or carriage returns | [\t\r\n\s]+ |
The word Level only if it appears at the offset position in the string | Level$ |
The longest string within parentheses | (.*) |
The longest string within parentheses, but not containing any parentheses within it | ([~()]*) |
A left bracket | \[ |
A right bracket | \] |
cat, dog, cot, dot, cog | [cd][ao][tg] |
A string containing all the characters in string that occur before the match.
First string after offset that matches the pattern specified by regular expression.
A string containing all characters in string that follow the match.
The index in string of the first byte of after substring. If the node does not find a match, offset past match is -1.
string | regular expression | offset | match | offset past match | Comments |
---|---|---|---|---|---|
cdb | b* | 0 | "" | 0 | The offset input and the offset past match output might be equal when the empty string is a valid match for the regular expression. |
bbbcd | b* | 0 | bbb | 3 | Notice that offset does not equal offset past match because a longer match than the empty string existed. |