Table Of Contents

Search and Replace String (G Dataflow)

Version:
Last Modified: March 3, 2017

Replaces all instances of a substring with another substring.

connector_pane_image
datatype_icon

multiline?

A Boolean value that determines whether to treat the text in the input string as a multiple-line string. This affects how the ^ and $ characters handle matches.

True ^ matches the beginning of any line in the input string. $ matches the end of any line in the input string.
False ^ matches only the beginning of the input string. $ matches only the end of the input string.

Default: False

datatype_icon

ignore case

Boolean value that determines whether the string search is case sensitive.

True The search ignores the letter case of the input.
False The search matches the letter case of the input.

Default: False

datatype_icon

replace all

A Boolean value that determines whether the node replaces all occurrences of the search string or only the first occurrence.

True The search replaces all matches for the search string.
False The search replaces only the first occurrence of a match.

Default: False

datatype_icon

input string

The string this node searches.

datatype_icon

search string

The string you want to replace if it exists in the input string.

Implications of Empty String

If search string is an empty string and replace all is False, the node inserts replace string at the beginning of input string. If search string is an empty string and replace all is True, the node inserts replace string at the beginning of input string, in between each character, and at the end.

datatype_icon

replace string

The string used to replace search string in input string.

Default: Empty string

datatype_icon

offset

The number of bytes into the input string at which this node starts searching.

The offset of the first byte in the input string is 0. If offset is beyond the end of the input string, this node returns an empty string.

spd-note-note
Note  

Strings are encoded in UTF-8. For strings containing characters in the U+0000 through U+007F range, the number of bytes in a string is equivalent to the number of characters. However, for strings containing the characters U+0080 through U+7FFFFFFF, the number of bytes is greater than the number of characters.

datatype_icon

error in

Error conditions that occur before this node runs.

The node responds to this input according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error
If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

Default: No error

datatype_icon

result string

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.

datatype_icon

number of replacements

Number of times this node replaced search string.

datatype_icon

offset past replacement

The offset of the byte immediately following where the last match and replacement occurred in the result string.

If the node does not find the search string, this output is -1.

If replace all is False, the next match, if any, is after this point.

spd-note-note
Note  

Strings are encoded in UTF-8. For strings containing characters in the U+0000 through U+007F range, the number of bytes in a string is equivalent to the number of characters. However, for strings containing the characters U+0080 through U+7FFFFFFF, the number of bytes is greater than the number of characters.

datatype_icon

error out

Error information.

The node produces this output according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error
If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

Searching for Complex Patterns

If you want to search for complex patterns, like 5-character substrings ending with d, configure this node to search using regular expressions. Select Regular Expression in the Behavior section of the Item tab. This enables you to search for matches using regular expressions in the search string input.

You can also use the Match Regular Expression node instead, which uses the same regular expression syntax.

Where This Node Can Run:

Desktop OS: Windows

FPGA: DAQExpress does not support FPGA devices


Recently Viewed Topics