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.


icon

Inputs/Outputs

  • cbool.png replace all? (F)

    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.

  • cstr.png string

    string specifies the input string you want the function to search.

  • cstr.png regular expression ("")

    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.

  • cstr.png replace string ("")

    replace string replaces the substring in string that matches regular expression. The default is an empty string.

  • ci32.png offset (0)

    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.

  • istr.png result string

    result string contains the edited string with the replaced characters.

  • ii32.png offset past match

    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.

  • 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.