cut part of a string and use as variable?

Forgive my newbie’ness, but is it possible to find part of a string, cut it, and use it as a variable in subsequent steps?

For example, if I had the following string, “dogcatbird”

and i used a regex variable like “fish|frog|cat|rabbit”

could I find the “cat”, leave the string as “dogbird” and then capture “cat” as a variable?

I’ve been playing around with various workarounds to no avail. Thanks in advance, I find these forums invaluable in my learning.

What workarounds have you tried?

A simple way would be to

  1. use the Regex Extractor node to extract “cat” using the regex query you posted:


  2. Then use a String manipulation node to replace the matched text with nothing:


  3. If you want any of these values as a variable, you can use a Row to Variable node to do the conversion



Beautiful. Thank you.

I was trying to split the string after converting, stuff like that. But this is simple and elegant. I dont have the Regex Extractor node in my collection but hope to find the right extensions package to add it with.

Many thanks!

Hi Chumnley,

the “Regex Extractor” node is part of the Palladian plugin and available here:

You can find unknown nodes, workflows and metanodes via NodePit easily. For a smooth experience, we suggest to install the NodePit Plugin into KNIME, then you don’t need to manually copy update site URLs to your preferences. Instead, simply search the node directly within the KNIME view and click the “install” button:

– Philipp


This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.