<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://labviewwiki.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=MrJim</id>
	<title>LabVIEW Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://labviewwiki.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=MrJim"/>
	<link rel="alternate" type="text/html" href="https://labviewwiki.org/wiki/Special:Contributions/MrJim"/>
	<updated>2026-08-31T12:28:55Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://labviewwiki.org/w/index.php?title=Match_Regular_Expression_function&amp;diff=36035</id>
		<title>Match Regular Expression function</title>
		<link rel="alternate" type="text/html" href="https://labviewwiki.org/w/index.php?title=Match_Regular_Expression_function&amp;diff=36035"/>
		<updated>2026-08-28T23:31:41Z</updated>

		<summary type="html">&lt;p&gt;MrJim: /* Avoiding Stack Overflow */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LabVIEW Palette Object Information|palette=Functions Palette/Programming/String{{!}}String palette|type=function|icon=String Palette - Match Regular Expression.png}}&lt;br /&gt;
The &#039;&#039;&#039;Match Regular Expression function&#039;&#039;&#039; searches for a regular expression in the &#039;&#039;&#039;input string&#039;&#039;&#039; beginning at the &#039;&#039;&#039;offset&#039;&#039;&#039; 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.&lt;br /&gt;
{{TOCright}}&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
[[File:Match Regular Expression function.png|center]]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Parameters&lt;br /&gt;
! Data Type&lt;br /&gt;
! Name&lt;br /&gt;
! Required?&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
! [[File:Boolean.png|link=Boolean data type]]&lt;br /&gt;
| &#039;&#039;&#039;multiline?&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;multiline?&#039;&#039;&#039; specifies whether to treat the text in &#039;&#039;&#039;input string&#039;&#039;&#039; as a multiple-line string. This setting affects how the ^ and $ characters handle matches. &lt;br /&gt;
*If you set &#039;&#039;&#039;multiline?&#039;&#039;&#039; to FALSE (default), when you enter ^ at the beginning of a regular expression, the expression matches only the beginning of the string in &#039;&#039;&#039;input string&#039;&#039;&#039;. When you enter $ at the end of a regular expression, the expression matches only the end of the string in &#039;&#039;&#039;input string&#039;&#039;&#039;. &lt;br /&gt;
*If you set &#039;&#039;&#039;multiline?&#039;&#039;&#039; to TRUE, ^ matches the beginning of any line in &#039;&#039;&#039;input string&#039;&#039;&#039; and $ matches the end of any line in &#039;&#039;&#039;input string&#039;&#039;&#039;.&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;  The ^ character anchors the match to the beginning of a string when used as the first character of a pattern. If you add ^ to the beginning of a character class immediately after an open square bracket, the expression matches any character not in a given character class.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:Boolean.png|link=Boolean data type]]&lt;br /&gt;
| &#039;&#039;&#039;ignore case?&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;ignore case?&#039;&#039;&#039; specifies whether the string search is case sensitive. If FALSE (default), the string search is case sensitive.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:String.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;input string&#039;&#039;&#039;&lt;br /&gt;
| Yes&lt;br /&gt;
| &#039;&#039;&#039;input string&#039;&#039;&#039; specifies the input string the function searches. This string cannot contain null characters.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:String.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;regular expression&#039;&#039;&#039;&lt;br /&gt;
| Yes&lt;br /&gt;
| &#039;&#039;&#039;regular expression&#039;&#039;&#039; specifies the pattern you want to search for in &#039;&#039;&#039;input string&#039;&#039;&#039;. If the function does not find a match, &#039;&#039;&#039;whole match&#039;&#039;&#039; and &#039;&#039;&#039;after match&#039;&#039;&#039; contain empty strings, &#039;&#039;&#039;before match&#039;&#039;&#039; contains the entire input string, &#039;&#039;&#039;offset past match&#039;&#039;&#039; 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 &#039;&#039;&#039;substring 1..n&#039;&#039;&#039;. This string cannot contain null characters.&lt;br /&gt;
|- &lt;br /&gt;
! [[File:I32 Array.png|link=I32 data type]]&lt;br /&gt;
| &#039;&#039;&#039;offset&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;offset&#039;&#039;&#039; specifies the number of characters into &#039;&#039;&#039;input string&#039;&#039;&#039; at which the function starts searching for &#039;&#039;&#039;search string&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:Error Cluster.png|link=Error Cluster data type]]&lt;br /&gt;
| &#039;&#039;&#039;error in&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;error in&#039;&#039;&#039; describes error conditions that occur before this node runs. This input provides [[Error Cluster data type|standard error]] in functionality.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:String Indicator.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;before match&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;before match&#039;&#039;&#039; returns all the characters before the match. &lt;br /&gt;
|-&lt;br /&gt;
! [[File:String Indicator.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;whole match&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;whole match&#039;&#039;&#039; returns all the characters that match the expression entered in &#039;&#039;&#039;regular expression&#039;&#039;&#039;. Any substring matches the function finds appear in the submatch outputs.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:String Indicator.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;after match&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;after match&#039;&#039;&#039; returns all the characters after the match.&lt;br /&gt;
|- &lt;br /&gt;
! [[File:I32 Indicator.png|link=I32 data type]]&lt;br /&gt;
| &#039;&#039;&#039;offset past match&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;offset past match&#039;&#039;&#039; returns the index in &#039;&#039;&#039;input string&#039;&#039;&#039; of the first character after the last match. If the VI does not find a match, &#039;&#039;&#039;offset past match&#039;&#039;&#039; returns –1.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:Error Cluster Indicator.png|link=Error Cluster data type]]&lt;br /&gt;
| &#039;&#039;&#039;error out&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;error out&#039;&#039;&#039; contains error information. This output provides [[Error Cluster data type|standard error]] out functionality.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Details ===&lt;br /&gt;
*This function is used to match one or more substrings in &#039;&#039;&#039;input string&#039;&#039;&#039; by evaluating a &#039;&#039;&#039;regular expression&#039;&#039;&#039; against it, where the &#039;&#039;&#039;regular expression&#039;&#039;&#039; (&amp;quot;regex&amp;quot;) follows the standardized syntax defined by the Perl Compatible Regular Expression (PCRE) specification.&lt;br /&gt;
*Refer to the PCRE website at [http://www.pcre.org www.pcre.org] for more detailed information about Perl Compatible Regular Expressions.&lt;br /&gt;
*From a cursory perspective, the Match Regular Expression node is functionally very similar to the [[Match Pattern function]], but is much more powerful, arguably more versatile, and provides many additional options.&lt;br /&gt;
*The Match Regular Expression node executes much more slowly than the [[Match Pattern function]]. When executed relatively infrequently in an application, the difference is negligible, but when scaled and executed repeatedly, there is a noticeable performance penalty. Therefore, if the application does not require the power and complexity afforded by the Match Regular Expression function, the user may elect to use the [[Match Pattern function]] instead.&lt;br /&gt;
*Regular expression support is provided by the PCRE library package. Refer to &amp;lt;National Instruments&amp;gt;\_Legal Information directory for more information about the license under which the PCRE library package is redistributed.&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;  The Match Regular Expression function does not support null characters (i.e. bytes with values of zero) in the input strings. If strings wired to this function include null characters, LabVIEW returns an error and the function may return unexpected results.&lt;br /&gt;
&lt;br /&gt;
====Grouping Patterns for Submatches====&lt;br /&gt;
In straightforward use cases, the developer may simply rely on the value of the &#039;&#039;&#039;whole match&#039;&#039;&#039; terminal as the primary output of this function, as they would when using the [[Match Pattern function]]. For more complex use cases, multiple substrings from &#039;&#039;&#039;input string&#039;&#039;&#039; matching portions of the regular expression may be &amp;quot;captured,&amp;quot; or returned separately from &#039;&#039;&#039;whole match&#039;&#039;&#039; as &amp;quot;submatches.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
When captured groups are specified within the regex, the entirety of the match is predictably returned as the value of &#039;&#039;&#039;whole match&#039;&#039;&#039;, but smaller portions that are substrings of &#039;&#039;&#039;whole match&#039;&#039;&#039; are returned on separate output terminals.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;small&amp;gt;In official PCRE parlance, these submatches are referred to as &amp;quot;captured groups.&amp;quot; In the LabVIEW documentation for this function, the outputs for these captured groups are referred to as both &amp;quot;substrings&amp;quot; and &amp;quot;submatches&amp;quot; inconsistently.&amp;lt;/small&amp;gt;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The additional output terminals referred to as &amp;quot;&#039;&#039;&#039;Substring 1&#039;&#039;&#039;&amp;quot; .. &amp;quot;&#039;&#039;&#039;Substring  n&#039;&#039;&#039;&amp;quot; are exposed by dragging the bottom of the function to expand it, similar to the behavior of the [[Scan From String function]]. These outputs are not depicted in the illustration at the top of this article.&lt;br /&gt;
&lt;br /&gt;
Within the &#039;&#039;&#039;regular expression&#039;&#039;&#039;, the developer may specify that a portion of the match is to be captured and returned as a separate output by placing a subset of the regex within parentheses.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
* Suppose &amp;lt;code&amp;gt;Hello LabVIEW!&amp;lt;/code&amp;gt; is provided as the value of &#039;&#039;&#039;input string&#039;&#039;&#039;&lt;br /&gt;
* Also suppose that &amp;lt;code&amp;gt;(el.)..(L..)&amp;lt;/code&amp;gt; is provided as the value of &#039;&#039;&#039;regular expression&#039;&#039;&#039;, wherein &amp;lt;code&amp;gt;.&amp;lt;/code&amp;gt; may match any single character&lt;br /&gt;
* Upon execution of the Match Regular Expression function, the value of the &#039;&#039;&#039;whole match&#039;&#039;&#039; terminal is set to &amp;lt;code&amp;gt;ello Lab&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Submatch 1&#039;&#039;&#039; then has a value of &amp;lt;code&amp;gt;ell&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Submatch 2&#039;&#039;&#039; then has a value of &amp;lt;code&amp;gt;Lab&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If a captured group is nested within another captured group, the regular expression returns a submatch for the outer group before the inner group.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
* Suppose again that &amp;lt;code&amp;gt;Hello LabVIEW!&amp;lt;/code&amp;gt; is provided as the value of &#039;&#039;&#039;input string&#039;&#039;&#039;&lt;br /&gt;
* Also suppose that &amp;lt;code&amp;gt;(.(el.).).(L..)&amp;lt;/code&amp;gt; is provided as the value of &#039;&#039;&#039;regular expression&#039;&#039;&#039;&lt;br /&gt;
* Upon execution of the Match Regular Expression function, the value of the &#039;&#039;&#039;whole match&#039;&#039;&#039; terminal is set to &amp;lt;code&amp;gt;Hello Lab&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Submatch 1&#039;&#039;&#039; then has a value of &amp;lt;code&amp;gt;Hello&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Submatch 2&#039;&#039;&#039; has a value of &amp;lt;code&amp;gt;ell&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Submatch 3&#039;&#039;&#039; has a value of &amp;lt;code&amp;gt;Lab&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, &#039;&#039;&#039;Submatch 1&#039;&#039;&#039; is &amp;lt;code&amp;gt;Hello&amp;lt;/code&amp;gt; because the regular expression matches the outer character group before the inner group.&lt;br /&gt;
&lt;br /&gt;
====Avoiding Stack Overflow====&lt;br /&gt;
Certain regular expressions that use repeated capturing groups (such as &amp;lt;code&amp;gt;(.|\s)*&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;(a*)*&amp;lt;/code&amp;gt; ) require substantial resources to process when evaluated over large input strings, potentially leading to a stack overflow. Expressions involving captured groups that may cause excessive recursion are to be avoided for this reason. For example, evaluating the regular expression &amp;lt;code&amp;gt;(.|\n)*A&amp;lt;/code&amp;gt; over a large input string may cause LabVIEW to crash. To avoid recursion, the regular expression &amp;lt;code&amp;gt;(.|\n)*A&amp;lt;/code&amp;gt; may be rewritten as &amp;lt;code&amp;gt;(?s).*A&amp;lt;/code&amp;gt;. The &amp;lt;code&amp;gt;(?s)&amp;lt;/code&amp;gt; flag placed at the start of the regular expression instructs the compiler to include vertical white space characters when matching against the metacharacter, &amp;lt;code&amp;gt;.&amp;lt;/code&amp;gt; (a period character in an expression). &amp;lt;code&amp;gt;(.|\n)*A&amp;lt;/code&amp;gt; may also be rewritten as &amp;lt;code&amp;gt;[^A]*A&amp;lt;/code&amp;gt;, which perhaps unintuitively includes vertical white space when matching characters other than &amp;quot;A&amp;quot; that precede &amp;quot;A&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
As a general best practice, the developer may also wish to limit the allowable length of the input string to be evaluated by the regular expression.&lt;br /&gt;
&lt;br /&gt;
It should also be noted that characters or expressions that form a group need not be &#039;&#039;captured&#039;&#039; as a submatch. To group characters as part of an expression without capturing them as output, they may form a non-capturing group. The syntactical difference is that a non-capturing group includes &amp;lt;code&amp;gt;?:&amp;lt;/code&amp;gt; after the opening &amp;lt;code&amp;gt;(&amp;lt;/code&amp;gt;. For example, while &amp;lt;code&amp;gt;(ABC)&amp;lt;/code&amp;gt; matches the string &amp;quot;ABC&amp;quot; and includes it as a submatch, &amp;lt;code&amp;gt;(?:ABC)&amp;lt;/code&amp;gt; likewise groups the characters &amp;quot;ABC&amp;quot; together but does not return them as the value of a submatch output.&lt;br /&gt;
&lt;br /&gt;
== Tips and tricks ==&lt;br /&gt;
* Use back references to refer to previous partial matches in a regular expression. &amp;lt;code&amp;gt;\1&amp;lt;/code&amp;gt; refers to the first partial match, &amp;lt;code&amp;gt;\2&amp;lt;/code&amp;gt; to the second, and so on. For example, &amp;lt;code&amp;gt;(cat|dog) \1&amp;lt;/code&amp;gt; matches &amp;quot;cat cat&amp;quot; or &amp;quot;dog dog&amp;quot; but not &amp;quot;cat dog&amp;quot; or &amp;quot;dog cat&amp;quot;.&lt;br /&gt;
* Commenting regular expressions is encouraged for readability. There are two methods by which to accomplish this, both native to PCRE&#039;s syntax and not specific to LabVIEW.&lt;br /&gt;
*# Inline comments may be placed as in the following example: &amp;lt;code lang=&amp;quot;perl&amp;quot;&amp;gt;[A-Za-z\d]+(?#alphanumeric chars).+$&amp;lt;/code&amp;gt; , where &amp;quot;alphanumeric chars&amp;quot; comprises the inline comment.&lt;br /&gt;
*# More readable comments may be included by enabling commenting via the &amp;lt;code&amp;gt;(?x)&amp;lt;/code&amp;gt; flag. The flag must be specified at the very start of the regular expression: Doing so causes the PCRE compiler to ignore both horizontal and vertical white space as well as comments at the ends of lines that begin with &amp;lt;code&amp;gt;#&amp;lt;/code&amp;gt;. For example: &amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
(?x)       # Enable comments, ignore white space&lt;br /&gt;
I Lab      # The literal characters &amp;quot;I lab&amp;quot;&lt;br /&gt;
[WIEV]     # Any of {W, I, E, V}, case sensitive&lt;br /&gt;
s\w        # literal &amp;quot;s&amp;quot; followed by \w, which is an alphanumeric char or _&lt;br /&gt;
\hmuch     # horizontal white space (a tab or space) followed by &amp;quot;much&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;The reader should note that when the (?x) flag is in use, white space characters must be specified explicitly. e.g. &amp;lt;code&amp;gt;\s \h \v \t \r \n&amp;lt;/code&amp;gt; etc.&lt;br /&gt;
*Unlike the expression syntax for the [[Match Pattern function]], &amp;lt;code&amp;gt;\s&amp;lt;/code&amp;gt; does not refer to a literal space character (ASCII 0x20).&lt;br /&gt;
:White space characters are represented as follows:&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ White Space Characters&lt;br /&gt;
|-&lt;br /&gt;
! Escape !! ASCII Value !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| \t || 0x09 || Horizontal Tab (as from the tab key)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| \n || 0x0A || Line Feed&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| || 0x0B || Vertical Tab (not commonly used)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| \f || 0x0C|| Form Feed (not commonly used)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| \r || 0x0D || Carriage Return&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| || 0x20 || Space (as from the space bar)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|  \h || 0x20 0x09  || Space or Tab&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|  \v || 0x0A 0x0B 0x0C 0x0D  || Line Feed, Vertical Tab, Form Feed, Carriage Return&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|  \s || 0x09 0x0A 0x0B 0x0C 0x0D 0x20 || Union of characters included in \h and \v&lt;br /&gt;
|}&lt;br /&gt;
== XNode ==&lt;br /&gt;
This node is an example of how [[XNode]]s are used as a primitive node in LabVIEW.  It utilizes the [[AdaptToInputs (XNode Ability)|AdaptToInputs]], [[Bounds (XNode Ability)|Bounds]], [[DisplayName (XNode Ability)|DisplayName]], [[GenerateCode (XNode Ability)|GenerateCode]], [[GrowInfo (XNode Ability)|GrowInfo]], [[Help (XNode Ability)|Help]], [[Image (XNode Ability)|Image]], [[Initialize (XNode Ability)|Initialize]], [[Size (XNode Ability)|Size]], [[Terms (XNode Ability)|Terms]], and [[UpdateStateWithRef (XNode Ability)|UpdateStateWithRef]] abilities.  The abilities used can be viewed after enabling the [[LabVIEW configuration file/Miscellaneous#XNodeWizardMode|XNodeWizardMode]] INI flag.  Many of the ability VIs are password protected.&lt;br /&gt;
&lt;br /&gt;
If the user wishes to avoid using an [[XNode]] but retain the same functionality as the Match Regular Expression function, they may elect to substitute &amp;quot;Match Regular Expression_Execute.vi&amp;quot;, which contains the core functionality used by the former. This VI is located in the directory, &amp;quot;/vi.lib/regexp/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
{{ambox|text=History information is needed.  What changes have occurred over previous versions?}}&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Version&lt;br /&gt;
! Change(s)&lt;br /&gt;
|-&lt;br /&gt;
|[[File:LV2018.png|frameless|border|64x64px|LabVIEW 2018|link=LabVIEW 2018]]&lt;br /&gt;
|More info to come.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
*[[Match Pattern function]]&lt;br /&gt;
*[[XNode]]s&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
* [https://regex101.com/ RegEx101] - A great resource for trying out your regular expression.  Contains help, syntax highlighting, etc.  &#039;&#039;&#039;Note&#039;&#039;&#039; LabVIEW uses PCRE, select this when using the website.&lt;br /&gt;
* [http://www.pcre.org Perl Compatible Regular Expressions (PCRE) website] - The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5.&lt;br /&gt;
* [https://www.pcre.org/original/doc/html/pcrepattern.html PCRE Pattern Manual Page] - Detailed, official documentation of PCRE pattern syntax&lt;br /&gt;
* [https://www.pcre.org/original/doc/html/pcresyntax.html PCRE Syntax Manual Page] - More abbreviated official documentation of PCRE pattern syntax&lt;br /&gt;
* [https://www.debuggex.com/cheatsheet/regex/pcre Debuggex PCRE Cheat Sheet] - A succinct reference for PCRE syntax&lt;br /&gt;
&lt;br /&gt;
[[Category:String Palette]]&lt;/div&gt;</summary>
		<author><name>MrJim</name></author>
	</entry>
	<entry>
		<id>https://labviewwiki.org/w/index.php?title=Match_Regular_Expression_function&amp;diff=36034</id>
		<title>Match Regular Expression function</title>
		<link rel="alternate" type="text/html" href="https://labviewwiki.org/w/index.php?title=Match_Regular_Expression_function&amp;diff=36034"/>
		<updated>2026-08-28T23:19:41Z</updated>

		<summary type="html">&lt;p&gt;MrJim: Major edit of the Details section to provide more detail and clarity. Moved the &amp;quot;Grouping Patterns...&amp;quot; section before the &amp;quot;Avoiding Stack Overflow&amp;quot; section, since stack overflow section refers to captured groups. Changed the format of examples to bulleted lists for readability. Added &amp;lt;code&amp;gt; markup around code and input strings. Added a detailed explanation of a non-capturing group.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LabVIEW Palette Object Information|palette=Functions Palette/Programming/String{{!}}String palette|type=function|icon=String Palette - Match Regular Expression.png}}&lt;br /&gt;
The &#039;&#039;&#039;Match Regular Expression function&#039;&#039;&#039; searches for a regular expression in the &#039;&#039;&#039;input string&#039;&#039;&#039; beginning at the &#039;&#039;&#039;offset&#039;&#039;&#039; 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.&lt;br /&gt;
{{TOCright}}&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
[[File:Match Regular Expression function.png|center]]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Parameters&lt;br /&gt;
! Data Type&lt;br /&gt;
! Name&lt;br /&gt;
! Required?&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
! [[File:Boolean.png|link=Boolean data type]]&lt;br /&gt;
| &#039;&#039;&#039;multiline?&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;multiline?&#039;&#039;&#039; specifies whether to treat the text in &#039;&#039;&#039;input string&#039;&#039;&#039; as a multiple-line string. This setting affects how the ^ and $ characters handle matches. &lt;br /&gt;
*If you set &#039;&#039;&#039;multiline?&#039;&#039;&#039; to FALSE (default), when you enter ^ at the beginning of a regular expression, the expression matches only the beginning of the string in &#039;&#039;&#039;input string&#039;&#039;&#039;. When you enter $ at the end of a regular expression, the expression matches only the end of the string in &#039;&#039;&#039;input string&#039;&#039;&#039;. &lt;br /&gt;
*If you set &#039;&#039;&#039;multiline?&#039;&#039;&#039; to TRUE, ^ matches the beginning of any line in &#039;&#039;&#039;input string&#039;&#039;&#039; and $ matches the end of any line in &#039;&#039;&#039;input string&#039;&#039;&#039;.&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;  The ^ character anchors the match to the beginning of a string when used as the first character of a pattern. If you add ^ to the beginning of a character class immediately after an open square bracket, the expression matches any character not in a given character class.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:Boolean.png|link=Boolean data type]]&lt;br /&gt;
| &#039;&#039;&#039;ignore case?&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;ignore case?&#039;&#039;&#039; specifies whether the string search is case sensitive. If FALSE (default), the string search is case sensitive.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:String.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;input string&#039;&#039;&#039;&lt;br /&gt;
| Yes&lt;br /&gt;
| &#039;&#039;&#039;input string&#039;&#039;&#039; specifies the input string the function searches. This string cannot contain null characters.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:String.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;regular expression&#039;&#039;&#039;&lt;br /&gt;
| Yes&lt;br /&gt;
| &#039;&#039;&#039;regular expression&#039;&#039;&#039; specifies the pattern you want to search for in &#039;&#039;&#039;input string&#039;&#039;&#039;. If the function does not find a match, &#039;&#039;&#039;whole match&#039;&#039;&#039; and &#039;&#039;&#039;after match&#039;&#039;&#039; contain empty strings, &#039;&#039;&#039;before match&#039;&#039;&#039; contains the entire input string, &#039;&#039;&#039;offset past match&#039;&#039;&#039; 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 &#039;&#039;&#039;substring 1..n&#039;&#039;&#039;. This string cannot contain null characters.&lt;br /&gt;
|- &lt;br /&gt;
! [[File:I32 Array.png|link=I32 data type]]&lt;br /&gt;
| &#039;&#039;&#039;offset&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;offset&#039;&#039;&#039; specifies the number of characters into &#039;&#039;&#039;input string&#039;&#039;&#039; at which the function starts searching for &#039;&#039;&#039;search string&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:Error Cluster.png|link=Error Cluster data type]]&lt;br /&gt;
| &#039;&#039;&#039;error in&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;error in&#039;&#039;&#039; describes error conditions that occur before this node runs. This input provides [[Error Cluster data type|standard error]] in functionality.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:String Indicator.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;before match&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;before match&#039;&#039;&#039; returns all the characters before the match. &lt;br /&gt;
|-&lt;br /&gt;
! [[File:String Indicator.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;whole match&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;whole match&#039;&#039;&#039; returns all the characters that match the expression entered in &#039;&#039;&#039;regular expression&#039;&#039;&#039;. Any substring matches the function finds appear in the submatch outputs.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:String Indicator.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;after match&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;after match&#039;&#039;&#039; returns all the characters after the match.&lt;br /&gt;
|- &lt;br /&gt;
! [[File:I32 Indicator.png|link=I32 data type]]&lt;br /&gt;
| &#039;&#039;&#039;offset past match&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;offset past match&#039;&#039;&#039; returns the index in &#039;&#039;&#039;input string&#039;&#039;&#039; of the first character after the last match. If the VI does not find a match, &#039;&#039;&#039;offset past match&#039;&#039;&#039; returns –1.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:Error Cluster Indicator.png|link=Error Cluster data type]]&lt;br /&gt;
| &#039;&#039;&#039;error out&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;error out&#039;&#039;&#039; contains error information. This output provides [[Error Cluster data type|standard error]] out functionality.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Details ===&lt;br /&gt;
*This function is used to match one or more substrings in &#039;&#039;&#039;input string&#039;&#039;&#039; by evaluating a &#039;&#039;&#039;regular expression&#039;&#039;&#039; against it, where the &#039;&#039;&#039;regular expression&#039;&#039;&#039; (&amp;quot;regex&amp;quot;) follows the standardized syntax defined by the Perl Compatible Regular Expression (PCRE) specification.&lt;br /&gt;
*Refer to the PCRE website at [http://www.pcre.org www.pcre.org] for more detailed information about Perl Compatible Regular Expressions.&lt;br /&gt;
*From a cursory perspective, the Match Regular Expression node is functionally very similar to the [[Match Pattern function]], but is much more powerful, arguably more versatile, and provides many additional options.&lt;br /&gt;
*The Match Regular Expression node executes much more slowly than the [[Match Pattern function]]. When executed relatively infrequently in an application, the difference is negligible, but when scaled and executed repeatedly, there is a noticeable performance penalty. Therefore, if the application does not require the power and complexity afforded by the Match Regular Expression function, the user may elect to use the [[Match Pattern function]] instead.&lt;br /&gt;
*Regular expression support is provided by the PCRE library package. Refer to &amp;lt;National Instruments&amp;gt;\_Legal Information directory for more information about the license under which the PCRE library package is redistributed.&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;  The Match Regular Expression function does not support null characters (i.e. bytes with values of zero) in the input strings. If strings wired to this function include null characters, LabVIEW returns an error and the function may return unexpected results.&lt;br /&gt;
&lt;br /&gt;
====Grouping Patterns for Submatches====&lt;br /&gt;
In straightforward use cases, the developer may simply rely on the value of the &#039;&#039;&#039;whole match&#039;&#039;&#039; terminal as the primary output of this function, as they would when using the [[Match Pattern function]]. For more complex use cases, multiple substrings from &#039;&#039;&#039;input string&#039;&#039;&#039; matching portions of the regular expression may be &amp;quot;captured,&amp;quot; or returned separately from &#039;&#039;&#039;whole match&#039;&#039;&#039; as &amp;quot;submatches.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
When captured groups are specified within the regex, the entirety of the match is predictably returned as the value of &#039;&#039;&#039;whole match&#039;&#039;&#039;, but smaller portions that are substrings of &#039;&#039;&#039;whole match&#039;&#039;&#039; are returned on separate output terminals.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;small&amp;gt;In official PCRE parlance, these submatches are referred to as &amp;quot;captured groups.&amp;quot; In the LabVIEW documentation for this function, the outputs for these captured groups are referred to as both &amp;quot;substrings&amp;quot; and &amp;quot;submatches&amp;quot; inconsistently.&amp;lt;/small&amp;gt;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The additional output terminals referred to as &amp;quot;&#039;&#039;&#039;Substring 1&#039;&#039;&#039;&amp;quot; .. &amp;quot;&#039;&#039;&#039;Substring  n&#039;&#039;&#039;&amp;quot; are exposed by dragging the bottom of the function to expand it, similar to the behavior of the [[Scan From String function]]. These outputs are not depicted in the illustration at the top of this article.&lt;br /&gt;
&lt;br /&gt;
Within the &#039;&#039;&#039;regular expression&#039;&#039;&#039;, the developer may specify that a portion of the match is to be captured and returned as a separate output by placing a subset of the regex within parentheses.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
* Suppose &amp;lt;code&amp;gt;Hello LabVIEW!&amp;lt;/code&amp;gt; is provided as the value of &#039;&#039;&#039;input string&#039;&#039;&#039;&lt;br /&gt;
* Also suppose that &amp;lt;code&amp;gt;(el.)..(L..)&amp;lt;/code&amp;gt; is provided as the value of &#039;&#039;&#039;regular expression&#039;&#039;&#039;, wherein &amp;lt;code&amp;gt;.&amp;lt;/code&amp;gt; may match any single character&lt;br /&gt;
* Upon execution of the Match Regular Expression function, the value of the &#039;&#039;&#039;whole match&#039;&#039;&#039; terminal is set to &amp;lt;code&amp;gt;ello Lab&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Submatch 1&#039;&#039;&#039; then has a value of &amp;lt;code&amp;gt;ell&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Submatch 2&#039;&#039;&#039; then has a value of &amp;lt;code&amp;gt;Lab&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If a captured group is nested within another captured group, the regular expression returns a submatch for the outer group before the inner group.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
* Suppose again that &amp;lt;code&amp;gt;Hello LabVIEW!&amp;lt;/code&amp;gt; is provided as the value of &#039;&#039;&#039;input string&#039;&#039;&#039;&lt;br /&gt;
* Also suppose that &amp;lt;code&amp;gt;(.(el.).).(L..)&amp;lt;/code&amp;gt; is provided as the value of &#039;&#039;&#039;regular expression&#039;&#039;&#039;&lt;br /&gt;
* Upon execution of the Match Regular Expression function, the value of the &#039;&#039;&#039;whole match&#039;&#039;&#039; terminal is set to &amp;lt;code&amp;gt;Hello Lab&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Submatch 1&#039;&#039;&#039; then has a value of &amp;lt;code&amp;gt;Hello&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Submatch 2&#039;&#039;&#039; has a value of &amp;lt;code&amp;gt;ell&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Submatch 3&#039;&#039;&#039; has a value of &amp;lt;code&amp;gt;Lab&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, &#039;&#039;&#039;Submatch 1&#039;&#039;&#039; is &amp;lt;code&amp;gt;Hello&amp;lt;/code&amp;gt; because the regular expression matches the outer character group before the inner group.&lt;br /&gt;
&lt;br /&gt;
====Avoiding Stack Overflow====&lt;br /&gt;
Certain regular expressions that use repeated capturing groups (such as &amp;lt;code&amp;gt;(.|\s)*&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;(a*)*&amp;lt;/code&amp;gt; ) require substantial resources to process when evaluated over large input strings, potentially leading to a stack overflow. Expressions involving captured groups that may cause excessive recursion are to be avoided for this reason. For example, evaluating the regular expression &amp;lt;code&amp;gt;(.|\n)*A&amp;lt;/code&amp;gt; over a large input string may cause LabVIEW to crash. To avoid recursion, the regular expression &amp;lt;code&amp;gt;(.|\n)*A&amp;lt;/code&amp;gt; may be rewritten as &amp;lt;code&amp;gt;(?s).*A&amp;lt;/code&amp;gt;. The &amp;lt;code&amp;gt;(?s)&amp;lt;/code&amp;gt; flag placed at the start of the regular expression instructs the compiler to include vertical white space characters when matching against the metacharacter, &amp;lt;code&amp;gt;.&amp;lt;/code&amp;gt; (a period character in an expression). &amp;lt;code&amp;gt;(.|\n)*A&amp;lt;/code&amp;gt; may also be rewritten as &amp;lt;code&amp;gt;[^A]*A&amp;lt;/code&amp;gt;, which perhaps unintuitively includes vertical white space when matching characters other than &amp;quot;A&amp;quot; that precede &amp;quot;A&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
As a general best practice, the developer may also wish to limit the allowable length of the input string to be evaluated by the regular expression.&lt;br /&gt;
&lt;br /&gt;
It should also be noted that characters or expressions that form a group need not be &#039;&#039;captured&#039;&#039; as a submatch. To group characters as part of an expression without capturing them as output, they may form a non-capturing group. The syntactical difference is that a non-capturing group includes &amp;lt;code&amp;gt;?:&amp;lt;/code&amp;gt; after the opening &amp;lt;code&amp;gt;(&amp;lt;/code&amp;gt;. For example, while &amp;lt;code&amp;gt;(ABC)&amp;lt;/code&amp;gt; matches the string &amp;quot;ABC&amp;quot; and includes it as a submatch, &amp;lt;code&amp;gt;(?:ABC)&amp;lt;/code&amp;gt; likewise groups the characters &amp;quot;ABC&amp;quot; together but does not return them as the value of a substring output.&lt;br /&gt;
&lt;br /&gt;
== Tips and tricks ==&lt;br /&gt;
* Use back references to refer to previous partial matches in a regular expression. &amp;lt;code&amp;gt;\1&amp;lt;/code&amp;gt; refers to the first partial match, &amp;lt;code&amp;gt;\2&amp;lt;/code&amp;gt; to the second, and so on. For example, &amp;lt;code&amp;gt;(cat|dog) \1&amp;lt;/code&amp;gt; matches &amp;quot;cat cat&amp;quot; or &amp;quot;dog dog&amp;quot; but not &amp;quot;cat dog&amp;quot; or &amp;quot;dog cat&amp;quot;.&lt;br /&gt;
* Commenting regular expressions is encouraged for readability. There are two methods by which to accomplish this, both native to PCRE&#039;s syntax and not specific to LabVIEW.&lt;br /&gt;
*# Inline comments may be placed as in the following example: &amp;lt;code lang=&amp;quot;perl&amp;quot;&amp;gt;[A-Za-z\d]+(?#alphanumeric chars).+$&amp;lt;/code&amp;gt; , where &amp;quot;alphanumeric chars&amp;quot; comprises the inline comment.&lt;br /&gt;
*# More readable comments may be included by enabling commenting via the &amp;lt;code&amp;gt;(?x)&amp;lt;/code&amp;gt; flag. The flag must be specified at the very start of the regular expression: Doing so causes the PCRE compiler to ignore both horizontal and vertical white space as well as comments at the ends of lines that begin with &amp;lt;code&amp;gt;#&amp;lt;/code&amp;gt;. For example: &amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
(?x)       # Enable comments, ignore white space&lt;br /&gt;
I Lab      # The literal characters &amp;quot;I lab&amp;quot;&lt;br /&gt;
[WIEV]     # Any of {W, I, E, V}, case sensitive&lt;br /&gt;
s\w        # literal &amp;quot;s&amp;quot; followed by \w, which is an alphanumeric char or _&lt;br /&gt;
\hmuch     # horizontal white space (a tab or space) followed by &amp;quot;much&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;The reader should note that when the (?x) flag is in use, white space characters must be specified explicitly. e.g. &amp;lt;code&amp;gt;\s \h \v \t \r \n&amp;lt;/code&amp;gt; etc.&lt;br /&gt;
*Unlike the expression syntax for the [[Match Pattern function]], &amp;lt;code&amp;gt;\s&amp;lt;/code&amp;gt; does not refer to a literal space character (ASCII 0x20).&lt;br /&gt;
:White space characters are represented as follows:&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ White Space Characters&lt;br /&gt;
|-&lt;br /&gt;
! Escape !! ASCII Value !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| \t || 0x09 || Horizontal Tab (as from the tab key)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| \n || 0x0A || Line Feed&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| || 0x0B || Vertical Tab (not commonly used)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| \f || 0x0C|| Form Feed (not commonly used)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| \r || 0x0D || Carriage Return&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| || 0x20 || Space (as from the space bar)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|  \h || 0x20 0x09  || Space or Tab&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|  \v || 0x0A 0x0B 0x0C 0x0D  || Line Feed, Vertical Tab, Form Feed, Carriage Return&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|  \s || 0x09 0x0A 0x0B 0x0C 0x0D 0x20 || Union of characters included in \h and \v&lt;br /&gt;
|}&lt;br /&gt;
== XNode ==&lt;br /&gt;
This node is an example of how [[XNode]]s are used as a primitive node in LabVIEW.  It utilizes the [[AdaptToInputs (XNode Ability)|AdaptToInputs]], [[Bounds (XNode Ability)|Bounds]], [[DisplayName (XNode Ability)|DisplayName]], [[GenerateCode (XNode Ability)|GenerateCode]], [[GrowInfo (XNode Ability)|GrowInfo]], [[Help (XNode Ability)|Help]], [[Image (XNode Ability)|Image]], [[Initialize (XNode Ability)|Initialize]], [[Size (XNode Ability)|Size]], [[Terms (XNode Ability)|Terms]], and [[UpdateStateWithRef (XNode Ability)|UpdateStateWithRef]] abilities.  The abilities used can be viewed after enabling the [[LabVIEW configuration file/Miscellaneous#XNodeWizardMode|XNodeWizardMode]] INI flag.  Many of the ability VIs are password protected.&lt;br /&gt;
&lt;br /&gt;
If the user wishes to avoid using an [[XNode]] but retain the same functionality as the Match Regular Expression function, they may elect to substitute &amp;quot;Match Regular Expression_Execute.vi&amp;quot;, which contains the core functionality used by the former. This VI is located in the directory, &amp;quot;/vi.lib/regexp/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
{{ambox|text=History information is needed.  What changes have occurred over previous versions?}}&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Version&lt;br /&gt;
! Change(s)&lt;br /&gt;
|-&lt;br /&gt;
|[[File:LV2018.png|frameless|border|64x64px|LabVIEW 2018|link=LabVIEW 2018]]&lt;br /&gt;
|More info to come.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
*[[Match Pattern function]]&lt;br /&gt;
*[[XNode]]s&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
* [https://regex101.com/ RegEx101] - A great resource for trying out your regular expression.  Contains help, syntax highlighting, etc.  &#039;&#039;&#039;Note&#039;&#039;&#039; LabVIEW uses PCRE, select this when using the website.&lt;br /&gt;
* [http://www.pcre.org Perl Compatible Regular Expressions (PCRE) website] - The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5.&lt;br /&gt;
* [https://www.pcre.org/original/doc/html/pcrepattern.html PCRE Pattern Manual Page] - Detailed, official documentation of PCRE pattern syntax&lt;br /&gt;
* [https://www.pcre.org/original/doc/html/pcresyntax.html PCRE Syntax Manual Page] - More abbreviated official documentation of PCRE pattern syntax&lt;br /&gt;
* [https://www.debuggex.com/cheatsheet/regex/pcre Debuggex PCRE Cheat Sheet] - A succinct reference for PCRE syntax&lt;br /&gt;
&lt;br /&gt;
[[Category:String Palette]]&lt;/div&gt;</summary>
		<author><name>MrJim</name></author>
	</entry>
	<entry>
		<id>https://labviewwiki.org/w/index.php?title=Match_Regular_Expression_function&amp;diff=36033</id>
		<title>Match Regular Expression function</title>
		<link rel="alternate" type="text/html" href="https://labviewwiki.org/w/index.php?title=Match_Regular_Expression_function&amp;diff=36033"/>
		<updated>2026-08-28T21:15:46Z</updated>

		<summary type="html">&lt;p&gt;MrJim: /* Added Reference, External Links */ Added a reference to the Match Pattern function&amp;#039;s page. Added more external links that may prove useful to readers.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LabVIEW Palette Object Information|palette=Functions Palette/Programming/String{{!}}String palette|type=function|icon=String Palette - Match Regular Expression.png}}&lt;br /&gt;
The &#039;&#039;&#039;Match Regular Expression function&#039;&#039;&#039; searches for a regular expression in the &#039;&#039;&#039;input string&#039;&#039;&#039; beginning at the &#039;&#039;&#039;offset&#039;&#039;&#039; 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.&lt;br /&gt;
{{TOCright}}&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
[[File:Match Regular Expression function.png|center]]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Parameters&lt;br /&gt;
! Data Type&lt;br /&gt;
! Name&lt;br /&gt;
! Required?&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
! [[File:Boolean.png|link=Boolean data type]]&lt;br /&gt;
| &#039;&#039;&#039;multiline?&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;multiline?&#039;&#039;&#039; specifies whether to treat the text in &#039;&#039;&#039;input string&#039;&#039;&#039; as a multiple-line string. This setting affects how the ^ and $ characters handle matches. &lt;br /&gt;
*If you set &#039;&#039;&#039;multiline?&#039;&#039;&#039; to FALSE (default), when you enter ^ at the beginning of a regular expression, the expression matches only the beginning of the string in &#039;&#039;&#039;input string&#039;&#039;&#039;. When you enter $ at the end of a regular expression, the expression matches only the end of the string in &#039;&#039;&#039;input string&#039;&#039;&#039;. &lt;br /&gt;
*If you set &#039;&#039;&#039;multiline?&#039;&#039;&#039; to TRUE, ^ matches the beginning of any line in &#039;&#039;&#039;input string&#039;&#039;&#039; and $ matches the end of any line in &#039;&#039;&#039;input string&#039;&#039;&#039;.&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;  The ^ character anchors the match to the beginning of a string when used as the first character of a pattern. If you add ^ to the beginning of a character class immediately after an open square bracket, the expression matches any character not in a given character class.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:Boolean.png|link=Boolean data type]]&lt;br /&gt;
| &#039;&#039;&#039;ignore case?&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;ignore case?&#039;&#039;&#039; specifies whether the string search is case sensitive. If FALSE (default), the string search is case sensitive.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:String.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;input string&#039;&#039;&#039;&lt;br /&gt;
| Yes&lt;br /&gt;
| &#039;&#039;&#039;input string&#039;&#039;&#039; specifies the input string the function searches. This string cannot contain null characters.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:String.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;regular expression&#039;&#039;&#039;&lt;br /&gt;
| Yes&lt;br /&gt;
| &#039;&#039;&#039;regular expression&#039;&#039;&#039; specifies the pattern you want to search for in &#039;&#039;&#039;input string&#039;&#039;&#039;. If the function does not find a match, &#039;&#039;&#039;whole match&#039;&#039;&#039; and &#039;&#039;&#039;after match&#039;&#039;&#039; contain empty strings, &#039;&#039;&#039;before match&#039;&#039;&#039; contains the entire input string, &#039;&#039;&#039;offset past match&#039;&#039;&#039; 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 &#039;&#039;&#039;substring 1..n&#039;&#039;&#039;. This string cannot contain null characters.&lt;br /&gt;
|- &lt;br /&gt;
! [[File:I32 Array.png|link=I32 data type]]&lt;br /&gt;
| &#039;&#039;&#039;offset&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;offset&#039;&#039;&#039; specifies the number of characters into &#039;&#039;&#039;input string&#039;&#039;&#039; at which the function starts searching for &#039;&#039;&#039;search string&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:Error Cluster.png|link=Error Cluster data type]]&lt;br /&gt;
| &#039;&#039;&#039;error in&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;error in&#039;&#039;&#039; describes error conditions that occur before this node runs. This input provides [[Error Cluster data type|standard error]] in functionality.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:String Indicator.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;before match&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;before match&#039;&#039;&#039; returns all the characters before the match. &lt;br /&gt;
|-&lt;br /&gt;
! [[File:String Indicator.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;whole match&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;whole match&#039;&#039;&#039; returns all the characters that match the expression entered in &#039;&#039;&#039;regular expression&#039;&#039;&#039;. Any substring matches the function finds appear in the submatch outputs.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:String Indicator.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;after match&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;after match&#039;&#039;&#039; returns all the characters after the match.&lt;br /&gt;
|- &lt;br /&gt;
! [[File:I32 Indicator.png|link=I32 data type]]&lt;br /&gt;
| &#039;&#039;&#039;offset past match&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;offset past match&#039;&#039;&#039; returns the index in &#039;&#039;&#039;input string&#039;&#039;&#039; of the first character after the last match. If the VI does not find a match, &#039;&#039;&#039;offset past match&#039;&#039;&#039; returns –1.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:Error Cluster Indicator.png|link=Error Cluster data type]]&lt;br /&gt;
| &#039;&#039;&#039;error out&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;error out&#039;&#039;&#039; contains error information. This output provides [[Error Cluster data type|standard error]] out functionality.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Details ===&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;  The Match Regular Expression function does not support null characters in strings. If you include null characters in strings you wire to this function, LabVIEW returns an error and the function may return unexpected results.&lt;br /&gt;
&lt;br /&gt;
*Regular expression support is provided by the PCRE library package. Refer to &amp;lt;National Instruments&amp;gt;\_Legal Information directory for more information about the license under which the PCRE library package is redistributed.&lt;br /&gt;
*Refer to the PCRE website at [http://www.pcre.org www.pcre.org] for more information about Perl Compatible Regular Expressions.&lt;br /&gt;
*The Match Regular Expression function gives you more options for matching strings but performs more slowly than the [[Match Pattern function]].&lt;br /&gt;
*Use regular expressions (regex) in this function to refine searches.&lt;br /&gt;
&lt;br /&gt;
====Avoiding Stack Overflow====&lt;br /&gt;
Certain regular expressions that use repeated grouped expressions (such as (.|\s)* or (a*)*) require significant resources to process when applied to large input strings. In some cases a stack overflow may occur on large input strings. Some regular expressions may recurse repeatedly while attempting to match a large string, which may eventually overflow the stack. For example, the regular expression (.|\n)*A and a large input string may cause LabVIEW to crash. To avoid recursion, you can rewrite the regular expression (.|\n)*A as (?s).*A. The (?s) notation indicates that a period matches new lines. You also can rewrite the expression as [^A]*A.&lt;br /&gt;
&lt;br /&gt;
====Grouping Patterns for Submatches====&lt;br /&gt;
You can capture submatches by placing parentheses ( ) around a portion of a regular expression that you want the function to return as a submatch. For example, the regular expression (el.)..(L..) returns two submatches in the input string Hello LabVIEW!: ell and Lab. Each submatch corresponds to a character group in the order that the character group appears in the regular expression. In this example, &#039;&#039;&#039;submatch 1&#039;&#039;&#039; is ell and &#039;&#039;&#039;submatch 2&#039;&#039;&#039; is Lab.&lt;br /&gt;
&lt;br /&gt;
If you nest a character group within another character group, the regular expression creates a submatch for the outer group before the inner group. For example, the regular expression (.(el.).).(L..) returns three submatches in the input Hello LabVIEW!: Hello, ell, and Lab. In this example, &#039;&#039;&#039;submatch 1&#039;&#039;&#039; is Hello because the regular expression matches the outer character group before the inner group.&lt;br /&gt;
&lt;br /&gt;
== Tips and tricks ==&lt;br /&gt;
* Use back references to refer to previous partial matches in a regular expression. &amp;lt;code&amp;gt;\1&amp;lt;/code&amp;gt; refers to the first partial match, &amp;lt;code&amp;gt;\2&amp;lt;/code&amp;gt; to the second, and so on. For example, &amp;lt;code&amp;gt;(cat|dog) \1&amp;lt;/code&amp;gt; matches &amp;quot;cat cat&amp;quot; or &amp;quot;dog dog&amp;quot; but not &amp;quot;cat dog&amp;quot; or &amp;quot;dog cat&amp;quot;.&lt;br /&gt;
* Commenting regular expressions is encouraged for readability. There are two methods by which to accomplish this, both native to PCRE&#039;s syntax and not specific to LabVIEW.&lt;br /&gt;
*# Inline comments may be placed as in the following example: &amp;lt;code lang=&amp;quot;perl&amp;quot;&amp;gt;[A-Za-z\d]+(?#alphanumeric chars).+$&amp;lt;/code&amp;gt; , where &amp;quot;alphanumeric chars&amp;quot; comprises the inline comment.&lt;br /&gt;
*# More readable comments may be included by enabling commenting via the &amp;lt;code&amp;gt;(?x)&amp;lt;/code&amp;gt; flag. The flag must be specified at the very start of the regular expression: Doing so causes the PCRE compiler to ignore both horizontal and vertical white space as well as comments at the ends of lines that begin with &amp;lt;code&amp;gt;#&amp;lt;/code&amp;gt;. For example: &amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
(?x)       # Enable comments, ignore white space&lt;br /&gt;
I Lab      # The literal characters &amp;quot;I lab&amp;quot;&lt;br /&gt;
[WIEV]     # Any of {W, I, E, V}, case sensitive&lt;br /&gt;
s\w        # literal &amp;quot;s&amp;quot; followed by \w, which is an alphanumeric char or _&lt;br /&gt;
\hmuch     # horizontal white space (a tab or space) followed by &amp;quot;much&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;The reader should note that when the (?x) flag is in use, white space characters must be specified explicitly. e.g. &amp;lt;code&amp;gt;\s \h \v \t \r \n&amp;lt;/code&amp;gt; etc.&lt;br /&gt;
*Unlike the expression syntax for the [[Match Pattern function]], &amp;lt;code&amp;gt;\s&amp;lt;/code&amp;gt; does not refer to a literal space character (ASCII 0x20).&lt;br /&gt;
:White space characters are represented as follows:&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ White Space Characters&lt;br /&gt;
|-&lt;br /&gt;
! Escape !! ASCII Value !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| \t || 0x09 || Horizontal Tab (as from the tab key)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| \n || 0x0A || Line Feed&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| || 0x0B || Vertical Tab (not commonly used)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| \f || 0x0C|| Form Feed (not commonly used)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| \r || 0x0D || Carriage Return&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| || 0x20 || Space (as from the space bar)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|  \h || 0x20 0x09  || Space or Tab&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|  \v || 0x0A 0x0B 0x0C 0x0D  || Line Feed, Vertical Tab, Form Feed, Carriage Return&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|  \s || 0x09 0x0A 0x0B 0x0C 0x0D 0x20 || Union of characters included in \h and \v&lt;br /&gt;
|}&lt;br /&gt;
== XNode ==&lt;br /&gt;
This node is an example of how [[XNode]]s are used as a primitive node in LabVIEW.  It utilizes the [[AdaptToInputs (XNode Ability)|AdaptToInputs]], [[Bounds (XNode Ability)|Bounds]], [[DisplayName (XNode Ability)|DisplayName]], [[GenerateCode (XNode Ability)|GenerateCode]], [[GrowInfo (XNode Ability)|GrowInfo]], [[Help (XNode Ability)|Help]], [[Image (XNode Ability)|Image]], [[Initialize (XNode Ability)|Initialize]], [[Size (XNode Ability)|Size]], [[Terms (XNode Ability)|Terms]], and [[UpdateStateWithRef (XNode Ability)|UpdateStateWithRef]] abilities.  The abilities used can be viewed after enabling the [[LabVIEW configuration file/Miscellaneous#XNodeWizardMode|XNodeWizardMode]] INI flag.  Many of the ability VIs are password protected.&lt;br /&gt;
&lt;br /&gt;
If the user wishes to avoid using an [[XNode]] but retain the same functionality as the Match Regular Expression function, they may elect to substitute &amp;quot;Match Regular Expression_Execute.vi&amp;quot;, which contains the core functionality used by the former. This VI is located in the directory, &amp;quot;/vi.lib/regexp/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
{{ambox|text=History information is needed.  What changes have occurred over previous versions?}}&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Version&lt;br /&gt;
! Change(s)&lt;br /&gt;
|-&lt;br /&gt;
|[[File:LV2018.png|frameless|border|64x64px|LabVIEW 2018|link=LabVIEW 2018]]&lt;br /&gt;
|More info to come.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
*[[Match Pattern function]]&lt;br /&gt;
*[[XNode]]s&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
* [https://regex101.com/ RegEx101] - A great resource for trying out your regular expression.  Contains help, syntax highlighting, etc.  &#039;&#039;&#039;Note&#039;&#039;&#039; LabVIEW uses PCRE, select this when using the website.&lt;br /&gt;
* [http://www.pcre.org Perl Compatible Regular Expressions (PCRE) website] - The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5.&lt;br /&gt;
* [https://www.pcre.org/original/doc/html/pcrepattern.html PCRE Pattern Manual Page] - Detailed, official documentation of PCRE pattern syntax&lt;br /&gt;
* [https://www.pcre.org/original/doc/html/pcresyntax.html PCRE Syntax Manual Page] - More abbreviated official documentation of PCRE pattern syntax&lt;br /&gt;
* [https://www.debuggex.com/cheatsheet/regex/pcre Debuggex PCRE Cheat Sheet] - A succinct reference for PCRE syntax&lt;br /&gt;
&lt;br /&gt;
[[Category:String Palette]]&lt;/div&gt;</summary>
		<author><name>MrJim</name></author>
	</entry>
	<entry>
		<id>https://labviewwiki.org/w/index.php?title=Match_Regular_Expression_function&amp;diff=36032</id>
		<title>Match Regular Expression function</title>
		<link rel="alternate" type="text/html" href="https://labviewwiki.org/w/index.php?title=Match_Regular_Expression_function&amp;diff=36032"/>
		<updated>2026-08-28T21:06:01Z</updated>

		<summary type="html">&lt;p&gt;MrJim: /* Tips and tricks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LabVIEW Palette Object Information|palette=Functions Palette/Programming/String{{!}}String palette|type=function|icon=String Palette - Match Regular Expression.png}}&lt;br /&gt;
The &#039;&#039;&#039;Match Regular Expression function&#039;&#039;&#039; searches for a regular expression in the &#039;&#039;&#039;input string&#039;&#039;&#039; beginning at the &#039;&#039;&#039;offset&#039;&#039;&#039; 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.&lt;br /&gt;
{{TOCright}}&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
[[File:Match Regular Expression function.png|center]]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Parameters&lt;br /&gt;
! Data Type&lt;br /&gt;
! Name&lt;br /&gt;
! Required?&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
! [[File:Boolean.png|link=Boolean data type]]&lt;br /&gt;
| &#039;&#039;&#039;multiline?&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;multiline?&#039;&#039;&#039; specifies whether to treat the text in &#039;&#039;&#039;input string&#039;&#039;&#039; as a multiple-line string. This setting affects how the ^ and $ characters handle matches. &lt;br /&gt;
*If you set &#039;&#039;&#039;multiline?&#039;&#039;&#039; to FALSE (default), when you enter ^ at the beginning of a regular expression, the expression matches only the beginning of the string in &#039;&#039;&#039;input string&#039;&#039;&#039;. When you enter $ at the end of a regular expression, the expression matches only the end of the string in &#039;&#039;&#039;input string&#039;&#039;&#039;. &lt;br /&gt;
*If you set &#039;&#039;&#039;multiline?&#039;&#039;&#039; to TRUE, ^ matches the beginning of any line in &#039;&#039;&#039;input string&#039;&#039;&#039; and $ matches the end of any line in &#039;&#039;&#039;input string&#039;&#039;&#039;.&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;  The ^ character anchors the match to the beginning of a string when used as the first character of a pattern. If you add ^ to the beginning of a character class immediately after an open square bracket, the expression matches any character not in a given character class.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:Boolean.png|link=Boolean data type]]&lt;br /&gt;
| &#039;&#039;&#039;ignore case?&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;ignore case?&#039;&#039;&#039; specifies whether the string search is case sensitive. If FALSE (default), the string search is case sensitive.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:String.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;input string&#039;&#039;&#039;&lt;br /&gt;
| Yes&lt;br /&gt;
| &#039;&#039;&#039;input string&#039;&#039;&#039; specifies the input string the function searches. This string cannot contain null characters.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:String.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;regular expression&#039;&#039;&#039;&lt;br /&gt;
| Yes&lt;br /&gt;
| &#039;&#039;&#039;regular expression&#039;&#039;&#039; specifies the pattern you want to search for in &#039;&#039;&#039;input string&#039;&#039;&#039;. If the function does not find a match, &#039;&#039;&#039;whole match&#039;&#039;&#039; and &#039;&#039;&#039;after match&#039;&#039;&#039; contain empty strings, &#039;&#039;&#039;before match&#039;&#039;&#039; contains the entire input string, &#039;&#039;&#039;offset past match&#039;&#039;&#039; 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 &#039;&#039;&#039;substring 1..n&#039;&#039;&#039;. This string cannot contain null characters.&lt;br /&gt;
|- &lt;br /&gt;
! [[File:I32 Array.png|link=I32 data type]]&lt;br /&gt;
| &#039;&#039;&#039;offset&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;offset&#039;&#039;&#039; specifies the number of characters into &#039;&#039;&#039;input string&#039;&#039;&#039; at which the function starts searching for &#039;&#039;&#039;search string&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:Error Cluster.png|link=Error Cluster data type]]&lt;br /&gt;
| &#039;&#039;&#039;error in&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;error in&#039;&#039;&#039; describes error conditions that occur before this node runs. This input provides [[Error Cluster data type|standard error]] in functionality.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:String Indicator.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;before match&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;before match&#039;&#039;&#039; returns all the characters before the match. &lt;br /&gt;
|-&lt;br /&gt;
! [[File:String Indicator.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;whole match&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;whole match&#039;&#039;&#039; returns all the characters that match the expression entered in &#039;&#039;&#039;regular expression&#039;&#039;&#039;. Any substring matches the function finds appear in the submatch outputs.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:String Indicator.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;after match&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;after match&#039;&#039;&#039; returns all the characters after the match.&lt;br /&gt;
|- &lt;br /&gt;
! [[File:I32 Indicator.png|link=I32 data type]]&lt;br /&gt;
| &#039;&#039;&#039;offset past match&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;offset past match&#039;&#039;&#039; returns the index in &#039;&#039;&#039;input string&#039;&#039;&#039; of the first character after the last match. If the VI does not find a match, &#039;&#039;&#039;offset past match&#039;&#039;&#039; returns –1.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:Error Cluster Indicator.png|link=Error Cluster data type]]&lt;br /&gt;
| &#039;&#039;&#039;error out&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;error out&#039;&#039;&#039; contains error information. This output provides [[Error Cluster data type|standard error]] out functionality.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Details ===&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;  The Match Regular Expression function does not support null characters in strings. If you include null characters in strings you wire to this function, LabVIEW returns an error and the function may return unexpected results.&lt;br /&gt;
&lt;br /&gt;
*Regular expression support is provided by the PCRE library package. Refer to &amp;lt;National Instruments&amp;gt;\_Legal Information directory for more information about the license under which the PCRE library package is redistributed.&lt;br /&gt;
*Refer to the PCRE website at [http://www.pcre.org www.pcre.org] for more information about Perl Compatible Regular Expressions.&lt;br /&gt;
*The Match Regular Expression function gives you more options for matching strings but performs more slowly than the [[Match Pattern function]].&lt;br /&gt;
*Use regular expressions (regex) in this function to refine searches.&lt;br /&gt;
&lt;br /&gt;
====Avoiding Stack Overflow====&lt;br /&gt;
Certain regular expressions that use repeated grouped expressions (such as (.|\s)* or (a*)*) require significant resources to process when applied to large input strings. In some cases a stack overflow may occur on large input strings. Some regular expressions may recurse repeatedly while attempting to match a large string, which may eventually overflow the stack. For example, the regular expression (.|\n)*A and a large input string may cause LabVIEW to crash. To avoid recursion, you can rewrite the regular expression (.|\n)*A as (?s).*A. The (?s) notation indicates that a period matches new lines. You also can rewrite the expression as [^A]*A.&lt;br /&gt;
&lt;br /&gt;
====Grouping Patterns for Submatches====&lt;br /&gt;
You can capture submatches by placing parentheses ( ) around a portion of a regular expression that you want the function to return as a submatch. For example, the regular expression (el.)..(L..) returns two submatches in the input string Hello LabVIEW!: ell and Lab. Each submatch corresponds to a character group in the order that the character group appears in the regular expression. In this example, &#039;&#039;&#039;submatch 1&#039;&#039;&#039; is ell and &#039;&#039;&#039;submatch 2&#039;&#039;&#039; is Lab.&lt;br /&gt;
&lt;br /&gt;
If you nest a character group within another character group, the regular expression creates a submatch for the outer group before the inner group. For example, the regular expression (.(el.).).(L..) returns three submatches in the input Hello LabVIEW!: Hello, ell, and Lab. In this example, &#039;&#039;&#039;submatch 1&#039;&#039;&#039; is Hello because the regular expression matches the outer character group before the inner group.&lt;br /&gt;
&lt;br /&gt;
== Tips and tricks ==&lt;br /&gt;
* Use back references to refer to previous partial matches in a regular expression. &amp;lt;code&amp;gt;\1&amp;lt;/code&amp;gt; refers to the first partial match, &amp;lt;code&amp;gt;\2&amp;lt;/code&amp;gt; to the second, and so on. For example, &amp;lt;code&amp;gt;(cat|dog) \1&amp;lt;/code&amp;gt; matches &amp;quot;cat cat&amp;quot; or &amp;quot;dog dog&amp;quot; but not &amp;quot;cat dog&amp;quot; or &amp;quot;dog cat&amp;quot;.&lt;br /&gt;
* Commenting regular expressions is encouraged for readability. There are two methods by which to accomplish this, both native to PCRE&#039;s syntax and not specific to LabVIEW.&lt;br /&gt;
*# Inline comments may be placed as in the following example: &amp;lt;code lang=&amp;quot;perl&amp;quot;&amp;gt;[A-Za-z\d]+(?#alphanumeric chars).+$&amp;lt;/code&amp;gt; , where &amp;quot;alphanumeric chars&amp;quot; comprises the inline comment.&lt;br /&gt;
*# More readable comments may be included by enabling commenting via the &amp;lt;code&amp;gt;(?x)&amp;lt;/code&amp;gt; flag. The flag must be specified at the very start of the regular expression: Doing so causes the PCRE compiler to ignore both horizontal and vertical white space as well as comments at the ends of lines that begin with &amp;lt;code&amp;gt;#&amp;lt;/code&amp;gt;. For example: &amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
(?x)       # Enable comments, ignore white space&lt;br /&gt;
I Lab      # The literal characters &amp;quot;I lab&amp;quot;&lt;br /&gt;
[WIEV]     # Any of {W, I, E, V}, case sensitive&lt;br /&gt;
s\w        # literal &amp;quot;s&amp;quot; followed by \w, which is an alphanumeric char or _&lt;br /&gt;
\hmuch     # horizontal white space (a tab or space) followed by &amp;quot;much&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;The reader should note that when the (?x) flag is in use, white space characters must be specified explicitly. e.g. &amp;lt;code&amp;gt;\s \h \v \t \r \n&amp;lt;/code&amp;gt; etc.&lt;br /&gt;
*Unlike the expression syntax for the Match Pattern node, &amp;lt;code&amp;gt;\s&amp;lt;/code&amp;gt; does not refer to a literal space character (ASCII 0x20).&lt;br /&gt;
:White space characters are represented as follows:&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ White Space Characters&lt;br /&gt;
|-&lt;br /&gt;
! Escape !! ASCII Value !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| \t || 0x09 || Horizontal Tab (as from the tab key)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| \n || 0x0A || Line Feed&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| || 0x0B || Vertical Tab (not commonly used)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| \f || 0x0C|| Form Feed (not commonly used)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| \r || 0x0D || Carriage Return&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| || 0x20 || Space (as from the space bar)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|  \h || 0x20 0x09  || Space or Tab&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|  \v || 0x0A 0x0B 0x0C 0x0D  || Line Feed, Vertical Tab, Form Feed, Carriage Return&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|  \s || 0x09 0x0A 0x0B 0x0C 0x0D 0x20 || Union of characters included in \h and \v&lt;br /&gt;
|}&lt;br /&gt;
== XNode ==&lt;br /&gt;
This node is an example of how [[XNode]]s are used as a primitive node in LabVIEW.  It utilizes the [[AdaptToInputs (XNode Ability)|AdaptToInputs]], [[Bounds (XNode Ability)|Bounds]], [[DisplayName (XNode Ability)|DisplayName]], [[GenerateCode (XNode Ability)|GenerateCode]], [[GrowInfo (XNode Ability)|GrowInfo]], [[Help (XNode Ability)|Help]], [[Image (XNode Ability)|Image]], [[Initialize (XNode Ability)|Initialize]], [[Size (XNode Ability)|Size]], [[Terms (XNode Ability)|Terms]], and [[UpdateStateWithRef (XNode Ability)|UpdateStateWithRef]] abilities.  The abilities used can be viewed after enabling the [[LabVIEW configuration file/Miscellaneous#XNodeWizardMode|XNodeWizardMode]] INI flag.  Many of the ability VIs are password protected.&lt;br /&gt;
&lt;br /&gt;
If the user wishes to avoid using an [[XNode]] but retain the same functionality as the Match Regular Expression function, they may elect to substitute &amp;quot;Match Regular Expression_Execute.vi&amp;quot;, which contains the core functionality used by the former. This VI is located in the directory, &amp;quot;/vi.lib/regexp/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
{{ambox|text=History information is needed.  What changes have occurred over previous versions?}}&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Version&lt;br /&gt;
! Change(s)&lt;br /&gt;
|-&lt;br /&gt;
|[[File:LV2018.png|frameless|border|64x64px|LabVIEW 2018|link=LabVIEW 2018]]&lt;br /&gt;
|More info to come.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
*[[Match Pattern function]]&lt;br /&gt;
*[[XNode]]s&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
* [https://regex101.com/ RegEx101] - A great resource for trying out your regular expression.  Contains help, syntax highlighting, etc.  &#039;&#039;&#039;Note&#039;&#039;&#039; LabVIEW uses PCRE, select this when using the website.&lt;br /&gt;
* [http://www.pcre.org Perl Compatible Regular Expressions (PCRE) website] - The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5.&lt;br /&gt;
&lt;br /&gt;
[[Category:String Palette]]&lt;/div&gt;</summary>
		<author><name>MrJim</name></author>
	</entry>
	<entry>
		<id>https://labviewwiki.org/w/index.php?title=Match_Regular_Expression_function&amp;diff=36031</id>
		<title>Match Regular Expression function</title>
		<link rel="alternate" type="text/html" href="https://labviewwiki.org/w/index.php?title=Match_Regular_Expression_function&amp;diff=36031"/>
		<updated>2026-08-28T21:03:10Z</updated>

		<summary type="html">&lt;p&gt;MrJim: /* Tips and tricks */  Added explanation and table of white space escape sequences&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LabVIEW Palette Object Information|palette=Functions Palette/Programming/String{{!}}String palette|type=function|icon=String Palette - Match Regular Expression.png}}&lt;br /&gt;
The &#039;&#039;&#039;Match Regular Expression function&#039;&#039;&#039; searches for a regular expression in the &#039;&#039;&#039;input string&#039;&#039;&#039; beginning at the &#039;&#039;&#039;offset&#039;&#039;&#039; 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.&lt;br /&gt;
{{TOCright}}&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
[[File:Match Regular Expression function.png|center]]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Parameters&lt;br /&gt;
! Data Type&lt;br /&gt;
! Name&lt;br /&gt;
! Required?&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
! [[File:Boolean.png|link=Boolean data type]]&lt;br /&gt;
| &#039;&#039;&#039;multiline?&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;multiline?&#039;&#039;&#039; specifies whether to treat the text in &#039;&#039;&#039;input string&#039;&#039;&#039; as a multiple-line string. This setting affects how the ^ and $ characters handle matches. &lt;br /&gt;
*If you set &#039;&#039;&#039;multiline?&#039;&#039;&#039; to FALSE (default), when you enter ^ at the beginning of a regular expression, the expression matches only the beginning of the string in &#039;&#039;&#039;input string&#039;&#039;&#039;. When you enter $ at the end of a regular expression, the expression matches only the end of the string in &#039;&#039;&#039;input string&#039;&#039;&#039;. &lt;br /&gt;
*If you set &#039;&#039;&#039;multiline?&#039;&#039;&#039; to TRUE, ^ matches the beginning of any line in &#039;&#039;&#039;input string&#039;&#039;&#039; and $ matches the end of any line in &#039;&#039;&#039;input string&#039;&#039;&#039;.&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;  The ^ character anchors the match to the beginning of a string when used as the first character of a pattern. If you add ^ to the beginning of a character class immediately after an open square bracket, the expression matches any character not in a given character class.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:Boolean.png|link=Boolean data type]]&lt;br /&gt;
| &#039;&#039;&#039;ignore case?&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;ignore case?&#039;&#039;&#039; specifies whether the string search is case sensitive. If FALSE (default), the string search is case sensitive.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:String.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;input string&#039;&#039;&#039;&lt;br /&gt;
| Yes&lt;br /&gt;
| &#039;&#039;&#039;input string&#039;&#039;&#039; specifies the input string the function searches. This string cannot contain null characters.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:String.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;regular expression&#039;&#039;&#039;&lt;br /&gt;
| Yes&lt;br /&gt;
| &#039;&#039;&#039;regular expression&#039;&#039;&#039; specifies the pattern you want to search for in &#039;&#039;&#039;input string&#039;&#039;&#039;. If the function does not find a match, &#039;&#039;&#039;whole match&#039;&#039;&#039; and &#039;&#039;&#039;after match&#039;&#039;&#039; contain empty strings, &#039;&#039;&#039;before match&#039;&#039;&#039; contains the entire input string, &#039;&#039;&#039;offset past match&#039;&#039;&#039; 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 &#039;&#039;&#039;substring 1..n&#039;&#039;&#039;. This string cannot contain null characters.&lt;br /&gt;
|- &lt;br /&gt;
! [[File:I32 Array.png|link=I32 data type]]&lt;br /&gt;
| &#039;&#039;&#039;offset&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;offset&#039;&#039;&#039; specifies the number of characters into &#039;&#039;&#039;input string&#039;&#039;&#039; at which the function starts searching for &#039;&#039;&#039;search string&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:Error Cluster.png|link=Error Cluster data type]]&lt;br /&gt;
| &#039;&#039;&#039;error in&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;error in&#039;&#039;&#039; describes error conditions that occur before this node runs. This input provides [[Error Cluster data type|standard error]] in functionality.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:String Indicator.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;before match&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;before match&#039;&#039;&#039; returns all the characters before the match. &lt;br /&gt;
|-&lt;br /&gt;
! [[File:String Indicator.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;whole match&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;whole match&#039;&#039;&#039; returns all the characters that match the expression entered in &#039;&#039;&#039;regular expression&#039;&#039;&#039;. Any substring matches the function finds appear in the submatch outputs.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:String Indicator.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;after match&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;after match&#039;&#039;&#039; returns all the characters after the match.&lt;br /&gt;
|- &lt;br /&gt;
! [[File:I32 Indicator.png|link=I32 data type]]&lt;br /&gt;
| &#039;&#039;&#039;offset past match&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;offset past match&#039;&#039;&#039; returns the index in &#039;&#039;&#039;input string&#039;&#039;&#039; of the first character after the last match. If the VI does not find a match, &#039;&#039;&#039;offset past match&#039;&#039;&#039; returns –1.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:Error Cluster Indicator.png|link=Error Cluster data type]]&lt;br /&gt;
| &#039;&#039;&#039;error out&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;error out&#039;&#039;&#039; contains error information. This output provides [[Error Cluster data type|standard error]] out functionality.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Details ===&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;  The Match Regular Expression function does not support null characters in strings. If you include null characters in strings you wire to this function, LabVIEW returns an error and the function may return unexpected results.&lt;br /&gt;
&lt;br /&gt;
*Regular expression support is provided by the PCRE library package. Refer to &amp;lt;National Instruments&amp;gt;\_Legal Information directory for more information about the license under which the PCRE library package is redistributed.&lt;br /&gt;
*Refer to the PCRE website at [http://www.pcre.org www.pcre.org] for more information about Perl Compatible Regular Expressions.&lt;br /&gt;
*The Match Regular Expression function gives you more options for matching strings but performs more slowly than the [[Match Pattern function]].&lt;br /&gt;
*Use regular expressions (regex) in this function to refine searches.&lt;br /&gt;
&lt;br /&gt;
====Avoiding Stack Overflow====&lt;br /&gt;
Certain regular expressions that use repeated grouped expressions (such as (.|\s)* or (a*)*) require significant resources to process when applied to large input strings. In some cases a stack overflow may occur on large input strings. Some regular expressions may recurse repeatedly while attempting to match a large string, which may eventually overflow the stack. For example, the regular expression (.|\n)*A and a large input string may cause LabVIEW to crash. To avoid recursion, you can rewrite the regular expression (.|\n)*A as (?s).*A. The (?s) notation indicates that a period matches new lines. You also can rewrite the expression as [^A]*A.&lt;br /&gt;
&lt;br /&gt;
====Grouping Patterns for Submatches====&lt;br /&gt;
You can capture submatches by placing parentheses ( ) around a portion of a regular expression that you want the function to return as a submatch. For example, the regular expression (el.)..(L..) returns two submatches in the input string Hello LabVIEW!: ell and Lab. Each submatch corresponds to a character group in the order that the character group appears in the regular expression. In this example, &#039;&#039;&#039;submatch 1&#039;&#039;&#039; is ell and &#039;&#039;&#039;submatch 2&#039;&#039;&#039; is Lab.&lt;br /&gt;
&lt;br /&gt;
If you nest a character group within another character group, the regular expression creates a submatch for the outer group before the inner group. For example, the regular expression (.(el.).).(L..) returns three submatches in the input Hello LabVIEW!: Hello, ell, and Lab. In this example, &#039;&#039;&#039;submatch 1&#039;&#039;&#039; is Hello because the regular expression matches the outer character group before the inner group.&lt;br /&gt;
&lt;br /&gt;
== Tips and tricks ==&lt;br /&gt;
* Use back references to refer to previous partial matches in a regular expression. &amp;lt;code&amp;gt;\1&amp;lt;/code&amp;gt; refers to the first partial match, &amp;lt;code&amp;gt;\2&amp;lt;/code&amp;gt; to the second, and so on. For example, &amp;lt;code&amp;gt;(cat|dog) \1&amp;lt;/code&amp;gt; matches &amp;quot;cat cat&amp;quot; or &amp;quot;dog dog&amp;quot; but not &amp;quot;cat dog&amp;quot; or &amp;quot;dog cat&amp;quot;.&lt;br /&gt;
* Commenting regular expressions is encouraged for readability. There are two methods by which to accomplish this, both native to PCRE&#039;s syntax and not specific to LabVIEW.&lt;br /&gt;
*# Inline comments may be placed as in the following example: &amp;lt;code lang=&amp;quot;perl&amp;quot;&amp;gt;[A-Za-z\d]+(?#alphanumeric chars).+$&amp;lt;/code&amp;gt; , where &amp;quot;alphanumeric chars&amp;quot; comprises the inline comment.&lt;br /&gt;
*# More readable comments may be included by enabling commenting via the &amp;lt;code&amp;gt;(?x)&amp;lt;/code&amp;gt; flag. The flag must be specified at the very start of the regular expression: Doing so causes the PCRE compiler to ignore both horizontal and vertical white space as well as comments at the ends of lines that begin with &amp;lt;code&amp;gt;#&amp;lt;/code&amp;gt;. For example: &amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
(?x)       # Enable comments, ignore white space&lt;br /&gt;
I Lab      # The literal characters &amp;quot;I lab&amp;quot;&lt;br /&gt;
[WIEV]     # Any of {W, I, E, V}, case sensitive&lt;br /&gt;
s\w        # literal &amp;quot;s&amp;quot; followed by \w, which is an alphanumeric char or _&lt;br /&gt;
\hmuch     # horizontal white space (a tab or space) followed by &amp;quot;much&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;The reader should note that when the (?x) flag is in use, white space characters must be specified explicitly. e.g. &amp;lt;code&amp;gt;\s \h \v \t \r \n&amp;lt;/code&amp;gt; etc.&lt;br /&gt;
*Unlike the expression syntax for the Match Pattern node, &amp;lt;code&amp;gt;\s&amp;lt;/code&amp;gt; does not refer to a literal space character (ASCII 0x20).&lt;br /&gt;
:White space characters are represented as follows: {| class=&amp;quot;wikitable&amp;quot; |+ White Space Characters |- ! Escape !! ASCII Value !! Meaning |- | \t || 0x09 || Horizontal Tab (as from the tab key) |- | \n || 0x0A || Line Feed |- | || 0x0B || Vertical Tab (not commonly used) |- | \f || 0x0C|| Form Feed (not commonly used) |- | \r || 0x0D || Carriage Return |- | || 0x20 || Space (as from the space bar) |- |  \h || 0x20 0x09  || Space or Tab |- |  \v || 0x0A 0x0B 0x0C 0x0D  || Line Feed, Vertical Tab, Form Feed, Carriage Return |- |  \s || 0x09 0x0A 0x0B 0x0C 0x0D 0x20 || Union of characters included in \h and \v |}&lt;br /&gt;
&lt;br /&gt;
== XNode ==&lt;br /&gt;
This node is an example of how [[XNode]]s are used as a primitive node in LabVIEW.  It utilizes the [[AdaptToInputs (XNode Ability)|AdaptToInputs]], [[Bounds (XNode Ability)|Bounds]], [[DisplayName (XNode Ability)|DisplayName]], [[GenerateCode (XNode Ability)|GenerateCode]], [[GrowInfo (XNode Ability)|GrowInfo]], [[Help (XNode Ability)|Help]], [[Image (XNode Ability)|Image]], [[Initialize (XNode Ability)|Initialize]], [[Size (XNode Ability)|Size]], [[Terms (XNode Ability)|Terms]], and [[UpdateStateWithRef (XNode Ability)|UpdateStateWithRef]] abilities.  The abilities used can be viewed after enabling the [[LabVIEW configuration file/Miscellaneous#XNodeWizardMode|XNodeWizardMode]] INI flag.  Many of the ability VIs are password protected.&lt;br /&gt;
&lt;br /&gt;
If the user wishes to avoid using an [[XNode]] but retain the same functionality as the Match Regular Expression function, they may elect to substitute &amp;quot;Match Regular Expression_Execute.vi&amp;quot;, which contains the core functionality used by the former. This VI is located in the directory, &amp;quot;/vi.lib/regexp/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
{{ambox|text=History information is needed.  What changes have occurred over previous versions?}}&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Version&lt;br /&gt;
! Change(s)&lt;br /&gt;
|-&lt;br /&gt;
|[[File:LV2018.png|frameless|border|64x64px|LabVIEW 2018|link=LabVIEW 2018]]&lt;br /&gt;
|More info to come.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
*[[Match Pattern function]]&lt;br /&gt;
*[[XNode]]s&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
* [https://regex101.com/ RegEx101] - A great resource for trying out your regular expression.  Contains help, syntax highlighting, etc.  &#039;&#039;&#039;Note&#039;&#039;&#039; LabVIEW uses PCRE, select this when using the website.&lt;br /&gt;
* [http://www.pcre.org Perl Compatible Regular Expressions (PCRE) website] - The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5.&lt;br /&gt;
&lt;br /&gt;
[[Category:String Palette]]&lt;/div&gt;</summary>
		<author><name>MrJim</name></author>
	</entry>
	<entry>
		<id>https://labviewwiki.org/w/index.php?title=Match_Regular_Expression_function&amp;diff=36030</id>
		<title>Match Regular Expression function</title>
		<link rel="alternate" type="text/html" href="https://labviewwiki.org/w/index.php?title=Match_Regular_Expression_function&amp;diff=36030"/>
		<updated>2026-08-28T20:14:15Z</updated>

		<summary type="html">&lt;p&gt;MrJim: /* Tips and tricks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LabVIEW Palette Object Information|palette=Functions Palette/Programming/String{{!}}String palette|type=function|icon=String Palette - Match Regular Expression.png}}&lt;br /&gt;
The &#039;&#039;&#039;Match Regular Expression function&#039;&#039;&#039; searches for a regular expression in the &#039;&#039;&#039;input string&#039;&#039;&#039; beginning at the &#039;&#039;&#039;offset&#039;&#039;&#039; 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.&lt;br /&gt;
{{TOCright}}&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
[[File:Match Regular Expression function.png|center]]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Parameters&lt;br /&gt;
! Data Type&lt;br /&gt;
! Name&lt;br /&gt;
! Required?&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
! [[File:Boolean.png|link=Boolean data type]]&lt;br /&gt;
| &#039;&#039;&#039;multiline?&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;multiline?&#039;&#039;&#039; specifies whether to treat the text in &#039;&#039;&#039;input string&#039;&#039;&#039; as a multiple-line string. This setting affects how the ^ and $ characters handle matches. &lt;br /&gt;
*If you set &#039;&#039;&#039;multiline?&#039;&#039;&#039; to FALSE (default), when you enter ^ at the beginning of a regular expression, the expression matches only the beginning of the string in &#039;&#039;&#039;input string&#039;&#039;&#039;. When you enter $ at the end of a regular expression, the expression matches only the end of the string in &#039;&#039;&#039;input string&#039;&#039;&#039;. &lt;br /&gt;
*If you set &#039;&#039;&#039;multiline?&#039;&#039;&#039; to TRUE, ^ matches the beginning of any line in &#039;&#039;&#039;input string&#039;&#039;&#039; and $ matches the end of any line in &#039;&#039;&#039;input string&#039;&#039;&#039;.&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;  The ^ character anchors the match to the beginning of a string when used as the first character of a pattern. If you add ^ to the beginning of a character class immediately after an open square bracket, the expression matches any character not in a given character class.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:Boolean.png|link=Boolean data type]]&lt;br /&gt;
| &#039;&#039;&#039;ignore case?&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;ignore case?&#039;&#039;&#039; specifies whether the string search is case sensitive. If FALSE (default), the string search is case sensitive.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:String.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;input string&#039;&#039;&#039;&lt;br /&gt;
| Yes&lt;br /&gt;
| &#039;&#039;&#039;input string&#039;&#039;&#039; specifies the input string the function searches. This string cannot contain null characters.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:String.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;regular expression&#039;&#039;&#039;&lt;br /&gt;
| Yes&lt;br /&gt;
| &#039;&#039;&#039;regular expression&#039;&#039;&#039; specifies the pattern you want to search for in &#039;&#039;&#039;input string&#039;&#039;&#039;. If the function does not find a match, &#039;&#039;&#039;whole match&#039;&#039;&#039; and &#039;&#039;&#039;after match&#039;&#039;&#039; contain empty strings, &#039;&#039;&#039;before match&#039;&#039;&#039; contains the entire input string, &#039;&#039;&#039;offset past match&#039;&#039;&#039; 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 &#039;&#039;&#039;substring 1..n&#039;&#039;&#039;. This string cannot contain null characters.&lt;br /&gt;
|- &lt;br /&gt;
! [[File:I32 Array.png|link=I32 data type]]&lt;br /&gt;
| &#039;&#039;&#039;offset&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;offset&#039;&#039;&#039; specifies the number of characters into &#039;&#039;&#039;input string&#039;&#039;&#039; at which the function starts searching for &#039;&#039;&#039;search string&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:Error Cluster.png|link=Error Cluster data type]]&lt;br /&gt;
| &#039;&#039;&#039;error in&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;error in&#039;&#039;&#039; describes error conditions that occur before this node runs. This input provides [[Error Cluster data type|standard error]] in functionality.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:String Indicator.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;before match&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;before match&#039;&#039;&#039; returns all the characters before the match. &lt;br /&gt;
|-&lt;br /&gt;
! [[File:String Indicator.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;whole match&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;whole match&#039;&#039;&#039; returns all the characters that match the expression entered in &#039;&#039;&#039;regular expression&#039;&#039;&#039;. Any substring matches the function finds appear in the submatch outputs.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:String Indicator.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;after match&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;after match&#039;&#039;&#039; returns all the characters after the match.&lt;br /&gt;
|- &lt;br /&gt;
! [[File:I32 Indicator.png|link=I32 data type]]&lt;br /&gt;
| &#039;&#039;&#039;offset past match&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;offset past match&#039;&#039;&#039; returns the index in &#039;&#039;&#039;input string&#039;&#039;&#039; of the first character after the last match. If the VI does not find a match, &#039;&#039;&#039;offset past match&#039;&#039;&#039; returns –1.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:Error Cluster Indicator.png|link=Error Cluster data type]]&lt;br /&gt;
| &#039;&#039;&#039;error out&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;error out&#039;&#039;&#039; contains error information. This output provides [[Error Cluster data type|standard error]] out functionality.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Details ===&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;  The Match Regular Expression function does not support null characters in strings. If you include null characters in strings you wire to this function, LabVIEW returns an error and the function may return unexpected results.&lt;br /&gt;
&lt;br /&gt;
*Regular expression support is provided by the PCRE library package. Refer to &amp;lt;National Instruments&amp;gt;\_Legal Information directory for more information about the license under which the PCRE library package is redistributed.&lt;br /&gt;
*Refer to the PCRE website at [http://www.pcre.org www.pcre.org] for more information about Perl Compatible Regular Expressions.&lt;br /&gt;
*The Match Regular Expression function gives you more options for matching strings but performs more slowly than the [[Match Pattern function]].&lt;br /&gt;
*Use regular expressions (regex) in this function to refine searches.&lt;br /&gt;
&lt;br /&gt;
====Avoiding Stack Overflow====&lt;br /&gt;
Certain regular expressions that use repeated grouped expressions (such as (.|\s)* or (a*)*) require significant resources to process when applied to large input strings. In some cases a stack overflow may occur on large input strings. Some regular expressions may recurse repeatedly while attempting to match a large string, which may eventually overflow the stack. For example, the regular expression (.|\n)*A and a large input string may cause LabVIEW to crash. To avoid recursion, you can rewrite the regular expression (.|\n)*A as (?s).*A. The (?s) notation indicates that a period matches new lines. You also can rewrite the expression as [^A]*A.&lt;br /&gt;
&lt;br /&gt;
====Grouping Patterns for Submatches====&lt;br /&gt;
You can capture submatches by placing parentheses ( ) around a portion of a regular expression that you want the function to return as a submatch. For example, the regular expression (el.)..(L..) returns two submatches in the input string Hello LabVIEW!: ell and Lab. Each submatch corresponds to a character group in the order that the character group appears in the regular expression. In this example, &#039;&#039;&#039;submatch 1&#039;&#039;&#039; is ell and &#039;&#039;&#039;submatch 2&#039;&#039;&#039; is Lab.&lt;br /&gt;
&lt;br /&gt;
If you nest a character group within another character group, the regular expression creates a submatch for the outer group before the inner group. For example, the regular expression (.(el.).).(L..) returns three submatches in the input Hello LabVIEW!: Hello, ell, and Lab. In this example, &#039;&#039;&#039;submatch 1&#039;&#039;&#039; is Hello because the regular expression matches the outer character group before the inner group.&lt;br /&gt;
&lt;br /&gt;
== Tips and tricks ==&lt;br /&gt;
* Use back references to refer to previous partial matches in a regular expression. &amp;lt;code&amp;gt;\1&amp;lt;/code&amp;gt; refers to the first partial match, &amp;lt;code&amp;gt;\2&amp;lt;/code&amp;gt; to the second, and so on. For example, &amp;lt;code&amp;gt;(cat|dog) \1&amp;lt;/code&amp;gt; matches &amp;quot;cat cat&amp;quot; or &amp;quot;dog dog&amp;quot; but not &amp;quot;cat dog&amp;quot; or &amp;quot;dog cat&amp;quot;.&lt;br /&gt;
* Commenting regular expressions is encouraged for readability. There are two methods by which to accomplish this, both native to PCRE&#039;s syntax and not specific to LabVIEW.&lt;br /&gt;
*# Inline comments may be placed as in the following example: &amp;lt;code lang=&amp;quot;perl&amp;quot;&amp;gt;[A-Za-z\d]+(?#alphanumeric chars).+$&amp;lt;/code&amp;gt; , where &amp;quot;alphanumeric chars&amp;quot; comprises the inline comment.&lt;br /&gt;
*# More readable comments may be included by enabling commenting via the &amp;lt;code&amp;gt;(?x)&amp;lt;/code&amp;gt; flag. The flag must be specified at the very start of the regular expression: Doing so causes the PCRE compiler to ignore both horizontal and vertical white space as well as comments at the ends of lines that begin with &amp;lt;code&amp;gt;#&amp;lt;/code&amp;gt;. For example: &amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
(?x)       # Enable comments, ignore white space&lt;br /&gt;
I Lab      # The literal characters &amp;quot;I lab&amp;quot;&lt;br /&gt;
[WIEV]     # Any of {W, I, E, V}, case sensitive&lt;br /&gt;
s\w        # literal &amp;quot;s&amp;quot; followed by \w, which is an alphanumeric char or _&lt;br /&gt;
\hmuch     # horizontal white space (a tab or space) followed by &amp;quot;much&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;The read&lt;br /&gt;
== XNode ==&lt;br /&gt;
This node is an example of how [[XNode]]s are used as a primitive node in LabVIEW.  It utilizes the [[AdaptToInputs (XNode Ability)|AdaptToInputs]], [[Bounds (XNode Ability)|Bounds]], [[DisplayName (XNode Ability)|DisplayName]], [[GenerateCode (XNode Ability)|GenerateCode]], [[GrowInfo (XNode Ability)|GrowInfo]], [[Help (XNode Ability)|Help]], [[Image (XNode Ability)|Image]], [[Initialize (XNode Ability)|Initialize]], [[Size (XNode Ability)|Size]], [[Terms (XNode Ability)|Terms]], and [[UpdateStateWithRef (XNode Ability)|UpdateStateWithRef]] abilities.  The abilities used can be viewed after enabling the [[LabVIEW configuration file/Miscellaneous#XNodeWizardMode|XNodeWizardMode]] INI flag.  Many of the ability VIs are password protected.&lt;br /&gt;
&lt;br /&gt;
If the user wishes to avoid using an [[XNode]] but retain the same functionality as the Match Regular Expression function, they may elect to substitute &amp;quot;Match Regular Expression_Execute.vi&amp;quot;, which contains the core functionality used by the former. This VI is located in the directory, &amp;quot;/vi.lib/regexp/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
{{ambox|text=History information is needed.  What changes have occurred over previous versions?}}&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Version&lt;br /&gt;
! Change(s)&lt;br /&gt;
|-&lt;br /&gt;
|[[File:LV2018.png|frameless|border|64x64px|LabVIEW 2018|link=LabVIEW 2018]]&lt;br /&gt;
|More info to come.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
*[[Match Pattern function]]&lt;br /&gt;
*[[XNode]]s&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
* [https://regex101.com/ RegEx101] - A great resource for trying out your regular expression.  Contains help, syntax highlighting, etc.  &#039;&#039;&#039;Note&#039;&#039;&#039; LabVIEW uses PCRE, select this when using the website.&lt;br /&gt;
* [http://www.pcre.org Perl Compatible Regular Expressions (PCRE) website] - The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5.&lt;br /&gt;
&lt;br /&gt;
[[Category:String Palette]]&lt;/div&gt;</summary>
		<author><name>MrJim</name></author>
	</entry>
	<entry>
		<id>https://labviewwiki.org/w/index.php?title=Match_Regular_Expression_function&amp;diff=36029</id>
		<title>Match Regular Expression function</title>
		<link rel="alternate" type="text/html" href="https://labviewwiki.org/w/index.php?title=Match_Regular_Expression_function&amp;diff=36029"/>
		<updated>2026-08-28T19:37:33Z</updated>

		<summary type="html">&lt;p&gt;MrJim: /* XNode */ Provided readers with an equivalent alternative to this node that is a VI that ships with LabVIEW.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LabVIEW Palette Object Information|palette=Functions Palette/Programming/String{{!}}String palette|type=function|icon=String Palette - Match Regular Expression.png}}&lt;br /&gt;
The &#039;&#039;&#039;Match Regular Expression function&#039;&#039;&#039; searches for a regular expression in the &#039;&#039;&#039;input string&#039;&#039;&#039; beginning at the &#039;&#039;&#039;offset&#039;&#039;&#039; 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.&lt;br /&gt;
{{TOCright}}&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
[[File:Match Regular Expression function.png|center]]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Parameters&lt;br /&gt;
! Data Type&lt;br /&gt;
! Name&lt;br /&gt;
! Required?&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
! [[File:Boolean.png|link=Boolean data type]]&lt;br /&gt;
| &#039;&#039;&#039;multiline?&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;multiline?&#039;&#039;&#039; specifies whether to treat the text in &#039;&#039;&#039;input string&#039;&#039;&#039; as a multiple-line string. This setting affects how the ^ and $ characters handle matches. &lt;br /&gt;
*If you set &#039;&#039;&#039;multiline?&#039;&#039;&#039; to FALSE (default), when you enter ^ at the beginning of a regular expression, the expression matches only the beginning of the string in &#039;&#039;&#039;input string&#039;&#039;&#039;. When you enter $ at the end of a regular expression, the expression matches only the end of the string in &#039;&#039;&#039;input string&#039;&#039;&#039;. &lt;br /&gt;
*If you set &#039;&#039;&#039;multiline?&#039;&#039;&#039; to TRUE, ^ matches the beginning of any line in &#039;&#039;&#039;input string&#039;&#039;&#039; and $ matches the end of any line in &#039;&#039;&#039;input string&#039;&#039;&#039;.&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;  The ^ character anchors the match to the beginning of a string when used as the first character of a pattern. If you add ^ to the beginning of a character class immediately after an open square bracket, the expression matches any character not in a given character class.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:Boolean.png|link=Boolean data type]]&lt;br /&gt;
| &#039;&#039;&#039;ignore case?&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;ignore case?&#039;&#039;&#039; specifies whether the string search is case sensitive. If FALSE (default), the string search is case sensitive.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:String.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;input string&#039;&#039;&#039;&lt;br /&gt;
| Yes&lt;br /&gt;
| &#039;&#039;&#039;input string&#039;&#039;&#039; specifies the input string the function searches. This string cannot contain null characters.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:String.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;regular expression&#039;&#039;&#039;&lt;br /&gt;
| Yes&lt;br /&gt;
| &#039;&#039;&#039;regular expression&#039;&#039;&#039; specifies the pattern you want to search for in &#039;&#039;&#039;input string&#039;&#039;&#039;. If the function does not find a match, &#039;&#039;&#039;whole match&#039;&#039;&#039; and &#039;&#039;&#039;after match&#039;&#039;&#039; contain empty strings, &#039;&#039;&#039;before match&#039;&#039;&#039; contains the entire input string, &#039;&#039;&#039;offset past match&#039;&#039;&#039; 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 &#039;&#039;&#039;substring 1..n&#039;&#039;&#039;. This string cannot contain null characters.&lt;br /&gt;
|- &lt;br /&gt;
! [[File:I32 Array.png|link=I32 data type]]&lt;br /&gt;
| &#039;&#039;&#039;offset&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;offset&#039;&#039;&#039; specifies the number of characters into &#039;&#039;&#039;input string&#039;&#039;&#039; at which the function starts searching for &#039;&#039;&#039;search string&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:Error Cluster.png|link=Error Cluster data type]]&lt;br /&gt;
| &#039;&#039;&#039;error in&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;error in&#039;&#039;&#039; describes error conditions that occur before this node runs. This input provides [[Error Cluster data type|standard error]] in functionality.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:String Indicator.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;before match&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;before match&#039;&#039;&#039; returns all the characters before the match. &lt;br /&gt;
|-&lt;br /&gt;
! [[File:String Indicator.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;whole match&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;whole match&#039;&#039;&#039; returns all the characters that match the expression entered in &#039;&#039;&#039;regular expression&#039;&#039;&#039;. Any substring matches the function finds appear in the submatch outputs.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:String Indicator.png|link=String data type]]&lt;br /&gt;
| &#039;&#039;&#039;after match&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;after match&#039;&#039;&#039; returns all the characters after the match.&lt;br /&gt;
|- &lt;br /&gt;
! [[File:I32 Indicator.png|link=I32 data type]]&lt;br /&gt;
| &#039;&#039;&#039;offset past match&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;offset past match&#039;&#039;&#039; returns the index in &#039;&#039;&#039;input string&#039;&#039;&#039; of the first character after the last match. If the VI does not find a match, &#039;&#039;&#039;offset past match&#039;&#039;&#039; returns –1.&lt;br /&gt;
|-&lt;br /&gt;
! [[File:Error Cluster Indicator.png|link=Error Cluster data type]]&lt;br /&gt;
| &#039;&#039;&#039;error out&#039;&#039;&#039;&lt;br /&gt;
| No&lt;br /&gt;
| &#039;&#039;&#039;error out&#039;&#039;&#039; contains error information. This output provides [[Error Cluster data type|standard error]] out functionality.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Details ===&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;  The Match Regular Expression function does not support null characters in strings. If you include null characters in strings you wire to this function, LabVIEW returns an error and the function may return unexpected results.&lt;br /&gt;
&lt;br /&gt;
*Regular expression support is provided by the PCRE library package. Refer to &amp;lt;National Instruments&amp;gt;\_Legal Information directory for more information about the license under which the PCRE library package is redistributed.&lt;br /&gt;
*Refer to the PCRE website at [http://www.pcre.org www.pcre.org] for more information about Perl Compatible Regular Expressions.&lt;br /&gt;
*The Match Regular Expression function gives you more options for matching strings but performs more slowly than the [[Match Pattern function]].&lt;br /&gt;
*Use regular expressions (regex) in this function to refine searches.&lt;br /&gt;
&lt;br /&gt;
====Avoiding Stack Overflow====&lt;br /&gt;
Certain regular expressions that use repeated grouped expressions (such as (.|\s)* or (a*)*) require significant resources to process when applied to large input strings. In some cases a stack overflow may occur on large input strings. Some regular expressions may recurse repeatedly while attempting to match a large string, which may eventually overflow the stack. For example, the regular expression (.|\n)*A and a large input string may cause LabVIEW to crash. To avoid recursion, you can rewrite the regular expression (.|\n)*A as (?s).*A. The (?s) notation indicates that a period matches new lines. You also can rewrite the expression as [^A]*A.&lt;br /&gt;
&lt;br /&gt;
====Grouping Patterns for Submatches====&lt;br /&gt;
You can capture submatches by placing parentheses ( ) around a portion of a regular expression that you want the function to return as a submatch. For example, the regular expression (el.)..(L..) returns two submatches in the input string Hello LabVIEW!: ell and Lab. Each submatch corresponds to a character group in the order that the character group appears in the regular expression. In this example, &#039;&#039;&#039;submatch 1&#039;&#039;&#039; is ell and &#039;&#039;&#039;submatch 2&#039;&#039;&#039; is Lab.&lt;br /&gt;
&lt;br /&gt;
If you nest a character group within another character group, the regular expression creates a submatch for the outer group before the inner group. For example, the regular expression (.(el.).).(L..) returns three submatches in the input Hello LabVIEW!: Hello, ell, and Lab. In this example, &#039;&#039;&#039;submatch 1&#039;&#039;&#039; is Hello because the regular expression matches the outer character group before the inner group.&lt;br /&gt;
&lt;br /&gt;
== Tips and tricks ==&lt;br /&gt;
* Use back references to refer to previous partial matches in a regular expression. &amp;lt;code&amp;gt;\1&amp;lt;/code&amp;gt; refers to the first partial match, &amp;lt;code&amp;gt;\2&amp;lt;/code&amp;gt; to the second, and so on. For example, &amp;lt;code&amp;gt;(cat|dog) \1&amp;lt;/code&amp;gt; matches &amp;quot;cat cat&amp;quot; or &amp;quot;dog dog&amp;quot; but not &amp;quot;cat dog&amp;quot; or &amp;quot;dog cat&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== XNode ==&lt;br /&gt;
This node is an example of how [[XNode]]s are used as a primitive node in LabVIEW.  It utilizes the [[AdaptToInputs (XNode Ability)|AdaptToInputs]], [[Bounds (XNode Ability)|Bounds]], [[DisplayName (XNode Ability)|DisplayName]], [[GenerateCode (XNode Ability)|GenerateCode]], [[GrowInfo (XNode Ability)|GrowInfo]], [[Help (XNode Ability)|Help]], [[Image (XNode Ability)|Image]], [[Initialize (XNode Ability)|Initialize]], [[Size (XNode Ability)|Size]], [[Terms (XNode Ability)|Terms]], and [[UpdateStateWithRef (XNode Ability)|UpdateStateWithRef]] abilities.  The abilities used can be viewed after enabling the [[LabVIEW configuration file/Miscellaneous#XNodeWizardMode|XNodeWizardMode]] INI flag.  Many of the ability VIs are password protected.&lt;br /&gt;
&lt;br /&gt;
If the user wishes to avoid using an [[XNode]] but retain the same functionality as the Match Regular Expression function, they may elect to substitute &amp;quot;Match Regular Expression_Execute.vi&amp;quot;, which contains the core functionality used by the former. This VI is located in the directory, &amp;quot;/vi.lib/regexp/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
{{ambox|text=History information is needed.  What changes have occurred over previous versions?}}&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Version&lt;br /&gt;
! Change(s)&lt;br /&gt;
|-&lt;br /&gt;
|[[File:LV2018.png|frameless|border|64x64px|LabVIEW 2018|link=LabVIEW 2018]]&lt;br /&gt;
|More info to come.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
*[[Match Pattern function]]&lt;br /&gt;
*[[XNode]]s&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
* [https://regex101.com/ RegEx101] - A great resource for trying out your regular expression.  Contains help, syntax highlighting, etc.  &#039;&#039;&#039;Note&#039;&#039;&#039; LabVIEW uses PCRE, select this when using the website.&lt;br /&gt;
* [http://www.pcre.org Perl Compatible Regular Expressions (PCRE) website] - The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5.&lt;br /&gt;
&lt;br /&gt;
[[Category:String Palette]]&lt;/div&gt;</summary>
		<author><name>MrJim</name></author>
	</entry>
</feed>