How to remove text.

Hello, I’m doing a master in business analytics and big data and I’m quite new in KNIME. I would like to know how to remove the entire “adventure - works” in the row. I need to make a new field called “username” removing also the “/” thank you in advance.

화면 캡처 2022-02-21 213007

Hi @adrychinas and welcome to the Knime Community.

I’m not seeing any “/” in your data. Did you mean “\”?

You can take a look at the replace() function in the String Manipulation node.

¡Hi Bruno! Thank you for your answer. Yes, I meant “\ ”. Also, yes. Now I’m trying with the String Manipulation, but I am not sure how the nomenclature works. Trying to figure out. Thank you so much!

You can use this bit in a String Manipulation node:

substr($LoginID$, lastIndexOfChar($LoginID$, '\\') + 1)

It first looks for the index (=position) of the last backslash character in the string. The +1 increases the index to also remove the backslash.
Then it takes the substring starting from the index until the end of the string.

What you’re possibly missing: The backslash is usually used as escape character for meta characters (e.g. \n for a newline), so to interpret it literally, you need to escape it: \\ will be interpreted as single \.

4 Likes

Thank you so much, It worked perfectly. U rock!

3 Likes

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