Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Match Regular Expression

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

The Match Regular Expression function gives you more options for matching strings but performs more slowly than the Match Pattern function. Details  

Block Diagram Inputs
Block Diagram Outputs

Block Diagram Inputs

ParameterDescription
multiline?Sets whether or not to treat the text in input string as a multiple-line string. This affects how the ^ and $ characters handle matches. When FALSE (the default), entering "^" matches the beginning of the line in input string only and entering "$" matches the end of input string only. When TRUE, "^" matches the beginning of any line in input string and "$" matches the end of any line in input string.
ignore case?Specifies whether the string search is case sensitive. If FALSE (default), the string search is case sensitive.
input stringSpecifies the input string the function searches.
regular expressionSpecifies the pattern you want to search for in input string. If the function does not find a match, whole match and after match contain empty strings, before match contains the entire input string, offset past match returns –1, and all submatches outputs return empty strings. Place any substrings you want to search for in parentheses. The function returns any substring expressions it finds in substring 1..n.
offsetDetermines the number of characters into input string at which the function starts searching for search string.
error inDescribes error conditions that occur before this VI or function runs. The default is no error. If an error occurred before this VI or function runs, the VI or function passes the error in value to error out. This VI or function runs normally only if no error occurred before this VI or function runs. If an error occurs while this VI or function runs, it runs normally and sets its own error status in error out. Use the Simple Error Handler or General Error Handler VIs to display the description of the error code. Use error in and error out to check errors and to specify execution order by wiring error out from one node to error in of the next node.

Block Diagram Outputs

ParameterDescription
before matchReturns a string containing all the characters before the match.
whole matchContains all the characters that match the expression entered in regular expression. Any substring matches the function finds appear in the submatch outputs.
after matchContains all characters following the matched pattern entered in regular expression.
offset past matchReturns the index in input string of the first character after the last match. If the VI does not find a match, offset past match is –1.
error outContains error information. If error in indicates that an error occurred before this VI or function ran, error out contains the same error information. Otherwise, it describes the error status that this VI or function produces.

Match Regular Expression Details

Use regular expressions in this function to refine searches.

Certain regular expressions that use alternation (such as (.|\s)*) require significant resources to process when applied to large input strings. In some cases a stack overflow will occur and you will get an error dialog. If this occurs try to simplify your regular expression, or reduce the size of the string that you are parsing.

Copyright

Copyright © 1997–2004 University of Cambridge. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of the University of Cambridge nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Resources


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit