Search and Replace Pattern VI

Owning Palette: Additional String VIs and Functions

Requires: Base Development System

Searches string for substrings that match regular expression and replaces those substrings with replace string. A regular expression requires a specific combination of characters for pattern matching. For more information about special characters in regular expressions, refer to the regular expression input description in the detailed help.

Details  

 Add to the block diagram  Find on the palette
If replace all? is TRUE, the VI replaces all substrings in string that match regular expression. If FALSE (default), the VI replaces only the first substring in string.
string specifies the input string you want the function to search.
regular expression is the pattern for which you want to search in string. You can use special characters in regular expression.

If the VI does not find regular expression, result string is string and offset past match is –1. If regular expression matches the empty string, the function makes no replacements, result string is string, and offset past match returns 0 or the length of the string, depending on whether replace all? is FALSE or TRUE, respectively.
replace string replaces the substring in string that matches regular expression. The default is an empty string.
offset specifies number of characters into string at which the function starts searching for a match. offset must be numeric. The offset of the first character in string is 0. If offset is unwired or less than 0, the function takes offset as 0.
result string contains the edited string with the replaced characters.
offset past match is the index in string of the first character after the last match. If the VI does not find a match, offset past match is –1.

Search and Replace Pattern Details

This VI is similar to the Match Pattern function.

This VI can perform a case-insensitive search or search for more complex patterns than the Search and Replace String function.