# Regular Expressions driving me nuts

**URL:** <https://forum.knime.com/t/regular-expressions-driving-me-nuts/13788>\
**Category:** KNIME Analytics Platform\
**Created:** [March 12, 2019, 10:05am UTC](https://forum.knime.com/t/regular-expressions-driving-me-nuts/13788 "2019-03-12T10:05:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![knimerin](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/k/ba9def/32.png) [@knimerin](https://forum.knime.com/u/knimerin)\
**Post date:** [March 12, 2019, 10:05am UTC](https://forum.knime.com/t/regular-expressions-driving-me-nuts/13788/1 "2019-03-12T10:05:00Z")

</div>

Hi, I am a Perl power user and uses regex a lot. Saying this I can’t transfer simple things to Knime.  
For example I have a string:  
\str1\str2\str3

and I am trying to extract str3. I tried the string manipulation node with this command:

regexReplace($Path$, “.\*[\]”, “”)

But get empty cells ☹ Can anyone help?

---

<div class="post-metadata">

**Author:** ![johannes.schweig](https://forum-cdn.knime.com/user_avatar/forum.knime.com/johannes.schweig/32/1445_2.png) [@johannes.schweig](https://forum.knime.com/u/johannes.schweig)\
**Post date:** [March 12, 2019, 12:43pm UTC](https://forum.knime.com/t/regular-expressions-driving-me-nuts/13788/4 "2019-03-12T12:43:39Z")

</div>

Hey @knimerin,

I got it to work with  
`regexReplace($Path$, ".*\\\\", "")` (based on [this stackoverflow answer](https://stackoverflow.com/a/4025505/5905194)) - apparently you have to escape the backslash two times.

If you are doing a lot of string manipulation I can recommend you the [Column Expresisons](https://nodepit.com/node/org.knime.expressions.base.node.formulas.FormulasNodeFactory) Node (needs installation first). It is a bit more versatile and you can check your code on the first row in the dialog, so you don’t have to re-execute - open dialog.  
Cheers,  
Johannes

---

<div class="post-metadata">

**Author:** ![Vernalis](https://forum-cdn.knime.com/user_avatar/forum.knime.com/vernalis/32/356_2.png) [@Vernalis](https://forum.knime.com/u/Vernalis)\
**Post date:** [March 12, 2019, 2:08pm UTC](https://forum.knime.com/t/regular-expressions-driving-me-nuts/13788/5 "2019-03-12T14:08:46Z")

</div>

Yes, you have to escape the escapes, as round one of escapes are to a String, and then that is parsed to the regex.

Steve

---

<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:** [June 23, 2023, 8:33pm UTC](https://forum.knime.com/t/regular-expressions-driving-me-nuts/13788/6 "2023-06-23T20:33:00Z")

</div>


