|LabVIEW 2016 Help|
|LabVIEW 2017 Help|
|LabVIEW 2018 Help|
|LabVIEW 2019 Help|
|LabVIEW 2020 Help|
Owning Palette: String Functions
Requires: Base Development System
Replaces one or all instances of a substring with another substring. To include the multiline? input and enable advanced regular expression searches, right-click the function and select Regular Expression.
|multiline? specifies whether to treat the text in input string as a multiple-line string. This setting affects how the ^ and $ characters handle matches. If you set multiline? to FALSE (default), when you enter ^ at the beginning of a regular expression, the expression matches only the beginning of the string in input string. When you enter $ at the end of a regular expression, the expression matches only the end of the string in input string. If you set multiline? to TRUE, ^ matches the beginning of any line in input string and $ matches the end of any line in input string. |
|ignore case? specifies whether the string search is case sensitive. If FALSE (default), the string search is case sensitive.|
|replace all? specifies whether the function replaces all occurrences of the search string or only the first occurrence. If FALSE (default), the function replaces only the first occurrence.|
|input string specifies the input string you want the function to search.|
|search string specifies the string you want to search for and replace. If search string is an empty string and replace all? is FALSE, the function inserts replace string at the beginning of input string. If search string is an empty string and replace all? is TRUE, the function inserts replace string at the beginning, in between each character, and at the end of input string. |
To search using advanced regular expressions, right-click the function and select Regular Expression.
|replace string specifies the string you want to insert in place of search string. The default is an empty string. |
To configure the Search and Replace String function to accept backreferences in replace string, right-click the function and select Regular Expression.
|offset determines the number of characters into input string at which the function starts searching for search string.|
|error in describes error conditions that occur before this node runs. This input provides standard error in functionality.|
|result string contains the input string with one or all occurrences of search string replaced with replace string. If replace string is empty, result string contains input string with search string deleted.|
|number of replacements returns the number of times LabVIEW replaced search string.|
|offset past replacement indicates the offset in result string of the character immediately following where the last match and replacement occurred. If replace all? is FALSE, the next match, if any, is after this point. |
If the function does not find search string, offset past replacement returns –1.
|error out contains error information. This output provides standard error out functionality.|
|Note The Search and Replace String function does not support null characters in strings. If you include null characters in the strings you wire to this function, LabVIEW returns an error and the function may return unexpected results.|
If you want to search for more complex patterns, such as patterns that contain character grouping, alternate pattern matching, backreferences, or non-greedy quantification, configure the function for advanced regular expression searches or use the Match Regular Expression function.
To search for matches using advanced regular expressions in search string and partial match substitution in replace string, right-click the Search and Replace String function and select Regular Expression from the shortcut menu. This function uses the same regular expression syntax as the Match Regular Expression function.
Regular expression support is provided by the PCRE library package. Refer to the Copyright page at Legal Information»Copyright on the Contents tab for more information about the license under which the PCRE library package is redistributed.
Refer to the PCRE website at www.pcre.org for more information about Perl Compatible Regular Expressions.