substring search

I would like to know, if there is any node that searches a substring within a string???

You can use the String Manipulation node and make use of the indexOf(str, toSearch) function. For example:

indexOf($URL$, "www")

This will parse a list of URLs and returns the position of the substring. If the substring couldn't be found, the returned value is -1.

Best,
Marc

hi,

I am unclear what you want to do once you seach for a substring, so the desired node may be different.

If you want to find a Substring and replace it, use the String Replacer node, you can select replace all Occurrences which will search for all matches within the string.

You can also use the RegEx expression syntax in the String Replacer node.

There are also the "Indexing and Searching" nodes in the KNIME Labs category using Lucene syntax which allows substring searching. Use the "Table Indexer" node followed by the "Index Query" node.

Does these meet what you need.

Simon.

Hey,

you can use the String Manipulation node for this task. Use the function indexOf(str, toSearch), where str is the string type column that will be analyzed and toSearch the substring you want to find. For example:

indexOf($URL$, ".com")

This will create a new column with the position of the substring. In case the substring couldn't be found, the expression returns -1.

Best,
Marc

1 Like

Not sure if that is a satisfying answer. I'm having the same drama here, trying to find certain phrases in a document (long string field).