how to use regular expression to create a new column

Hi, guys. I want to create a new column according to a regular expression like this.


Which node should I use in KNIME? Thanks!

Hi @ThomasChen

To create a new column based on a regular expression in KNIME, you can use either the String Manipulation or Column Expressions node. Both provide powerful Regex functions to achieve this.

Here a simple exemple how to use a Regex function with String Manipulation node.

And the result

Note that the syntax of regular expressions in KNIME has some particularities. For instance, to use \d+ to specify one or more digits, a double escape is required, resulting in \\d+. This is what I used in the example above.

This double escaping will also apply whenever you use capturing groups or similar constructs in your regular expressions.

4 Likes