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:
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?
I got it to work with
regexReplace($Path$, ".*\\\\", "") (based on this stackoverflow answer) - 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 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.
Yes, you have to escape the escapes, as round one of escapes are to a String, and then that is parsed to the regex.