String Manipulation beginner questions

Hi,
As a real beginner in Knime and data i am trying to replace some text in a table using the String Manipulation node. At the moment i have 3 nodes containing the following ( 1 in each ) but i am sure that it must be possible to combine these into a single node expression ?

regexReplace($Col0_Arr[1]$," “,”;")

regexReplace($Col0_Arr[1]$," “,”;")

regexReplace($Col0_Arr[1]$,“inf”,“0”)

I realise its a simple question but any help would be great

thanks
Mark

Hello @mgirdwood ,

two questions:

  • why regex and not a simple replace()?
  • is it me or the first two rules are the same?

If you just want to substitute a space character with a semicolon and then “inf” with zero, you can do somethin like this:

replace(replace(nameColumn, " ", ";"), "inf", "0")

Have a nice day,
Raffaello

Thanks Raffaello

That helped, I have the 3 expressions as in one i have 3 x Space to remove and in the other i have 1 x Space remove, i found that using only the single space returns instead of a single ; there are ;;; which i then have to remove anyway to split the column later based on ; as a delimiter. So i ended up with
replace(replace(replace($Col0_Arr[1]$," " ,“;” )," " ,“;” ), “inf”,“0”)

Mark

1 Like

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