Owning Palette: String Functions
Requires: Base Development System
Searches for regular expression in string beginning at offset. If the function finds a match, it splits string into three substrings. A regular expression requires a specific combination of characters for pattern matching. This function gives you fewer options for matching strings but performs more quickly than the Match Regular Expression function.
The Match Pattern function 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. The connector pane displays the default data types for this polymorphic function.
Add to the block diagram | Find on the palette |
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. For example, the Match Pattern function does not support the parenthesis or vertical bar (|) characters.
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.
Note If you want to include special characters in the search string, you must enclose each special character in brackets. For example, to search for the string hz+, enter hz[+] in regular expression. Otherwise, LabVIEW uses the special character 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] |