I have a column of data which contains data like 12 months, 15 months, 44 months.
I am trying to use String Replacer node to replace " months" with “” and then convert the column to numeric. However, my data output remains unaltered. In the settings am providing my pattern as “months” and Replacement text as “”.
Can anyone please guide.
Welcome to KNIME Forum. I don’t know what why it doesn’t work. But it works on my machine. See this workflow string_replacer.knwf (14.1 KB)
I do not know why it has this problem for you
But you can also use string manipulation with this expression:
regexReplace($column1$,"months" ,"" )
@Sajjadmosaheb String Manipulation certainly works buddy but am trying to use the existing node which is supposed to do this job which does not work
Thanks for your solution.
Me still facing the problem
Any suggestions please?
Don’t fill anything in the Replacement text. Leave it blank .
Or use the Cell Splitter node, and split on white-space.
Another problem may be that you have “whole string” checked, I think you want “all occurrences”
did you manage to solve it? You don’t need quotes and make sure to choose option
... all occurrences instead of
... whole string otherwise you’ll do replacement only in case entire cell is matched.
One of KNIME advantages is possibility to solve same operation/task with different node/set of nodes. I wouldn’t stick with idea “Only String Replacer needs to be used to modify strings”. So I would go with @Sajjadmosaheb suggestion and if you want you can add description in node label (users including myself usually do that) what operation/modification you have done in that node.
Welcome to KNIME Community!
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.