Searches for regular expression in string beginning at offset, and if it finds a match, splits string into three substrings. A regular expression requires a specific combination of characters for pattern matching.
This function is similar to the Search and Replace Pattern VI. The Match Pattern function gives you fewer options for matching strings but performs more quickly than the Match Regular Expression function.
The connector pane displays the default data types for this polymorphic function.

![]() |
string is the input string to search. |
![]() |
regular expression is the pattern for which you want to search in string.
If the function 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. You can use special characters to refine the search. |
![]() |
offset is the starting position and must be numeric. The offset of the first character in string is 0. If unwired or if less than 0, the default is 0. |
![]() |
before substring returns a string containing all the characters before the match. |
![]() |
match substring is the matched string. |
![]() |
after substring contains all characters following the matched pattern. |
![]() |
offset past match is the index in string of the first character of after substring. If the function does not find a match, offset past match is –1. The offset input and the offset past match output might be equal when the empty string is a valid match for the regular expression. For example, if regular expression is b* and the string input is cdb, offset past match is 0. If string is bbbcd, offset past match is 3. |
The following table shows examples of regular expressions you can use with this function. Some of these examples use special characters to refine the search.
| Characters to Find | Regular Expression |
|---|---|
| VOLTS | VOLTS |
| All uppercase and lowercase versions of volts, that is, VOLTS, Volts, volts, and so on | [Vv][Oo][Ll][Tt][Ss] |
| A space, 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]+ |
| One or more characters other than digits | [~0-9]+ |
| The word Level only if it begins at the offset position in the string | ^Level |
| The word Volts only if it appears at the end of the string | Volts$ |
| 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, and so on. | [cd][ao][tg] |