# how to use regular expression to create a new column

**URL:** <https://forum.knime.com/t/how-to-use-regular-expression-to-create-a-new-column/84976>\
**Category:** KNIME Analytics Platform\
**Created:** [November 27, 2024, 8:22am UTC](https://forum.knime.com/t/how-to-use-regular-expression-to-create-a-new-column/84976 "2024-11-27T08:22:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ThomasChen](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/t/eb9ed0/32.png) [@ThomasChen](https://forum.knime.com/u/ThomasChen)\
**Post date:** [November 27, 2024, 8:22am UTC](https://forum.knime.com/t/how-to-use-regular-expression-to-create-a-new-column/84976/1 "2024-11-27T08:22:25Z")

</div>

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

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/4/7/47a3a3c33760912c09bdbfe98b21df85c132c8df.png)  
Which node should I use in KNIME? Thanks!

---

<div class="post-metadata">

**Author:** ![Stephane73](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/s/d2c977/32.png) [@Stephane73](https://forum.knime.com/u/Stephane73)\
**Post date:** [November 27, 2024, 7:13pm UTC](https://forum.knime.com/t/how-to-use-regular-expression-to-create-a-new-column/84976/2 "2024-11-27T19:13:51Z")

</div>

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.

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/e/0/e01122a8f7569b656d0dbc5ae2d1f739d482c552.png)

And the result

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/2/b/2bdacec53eec021b6fd0e127750734c962542e17.png)

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.

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [February 25, 2025, 7:13pm UTC](https://forum.knime.com/t/how-to-use-regular-expression-to-create-a-new-column/84976/3 "2025-02-25T19:13:59Z")

</div>

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