Match First String
- Updated2023-02-17
- 2 minute(s) read
Match First String
Compares each string in a string array to the beginning of an input string until it encounters a match. This node returns the string with the match removed and the array index of the match.

Inputs/Outputs

string
String to which string array is compared.
Default value: Empty string

string array
Array of strings you want to compare to string.
If the node encounters an empty string in this input, it considers that string a match.

output string
Original string with the match removed.
If the beginning of the string does not match any string in the array, this output returns the original string.

index
Numeric index of the match in the array.
If the beginning of the string does not match any string in the array, this output returns -1.
Examples
string | string array | output string | index | Comments |
Error 16: error occurred |
Error 1
Error 16 |
6: error occurred | 0 | The first match is Error 1 at index 0 in the array. |
Error 16: error occurred |
D
E |
rror 16: error occurred | 1 | The first match is E at index 1 in the array. |