Jump to content

Match Regular Expression function

From LabVIEW Wiki
Revision as of 14:13, 1 February 2021 by Q (talk | contribs) (Added input parameters)
Object information
Owning palette(s) String palette
Type Function
Requires Basic Development Environment
Icon

The Match Regular Expression function searches for a regular expression in the input string beginning at the offset you enter. If the function finds a match, it splits the string into three substrings and any number of submatches. Resize the function to view any submatches found in the string.

Usage

Parameters
Data Type Name Required? Description
multiline? No multiline? specifies whether to treat the text in input string as a multiple-line string. This setting affects how the ^ and $ characters handle matches.
  • If you set multiline? to FALSE (default), when you enter ^ at the beginning of a regular expression, the expression matches only the beginning of the string in input string. When you enter $ at the end of a regular expression, the expression matches only the end of the string in input string.
  • If you set multiline? to TRUE, ^ matches the beginning of any line in input string and $ matches the end of any line in input string.
ignore case? No ignore case? specifies whether the string search is case sensitive. If FALSE (default), the string search is case sensitive.
input string Yes input string specifies the input string the function searches. This string cannot contain null characters.
regular expression Yes regular expression specifies the pattern you want to search for in input string. If the function does not find a match, whole match and after match contain empty strings, before match contains the entire input string, offset past match returns –1, and all submatches outputs return empty strings. Place any substrings you want to search for in parentheses. The function returns any substring expressions it finds in substring 1..n. This string cannot contain null characters.
offset No offset specifies the number of characters into input string at which the function starts searching for search string.
error in No error in describes error conditions that occur before this node runs. This input provides standard error in functionality.

Best practice

Tips and tricks

  • Use back references to refer to previous partial matches in a regular expression. \1 refers to the first partial match, \2 to the second, and so on. For example, (cat|dog) \1 matches "cat cat" or "dog dog" but not "cat dog" or "dog cat".

History

See also

External links