I am trying to replace all “-” out of multiple columns in my dataset.
I know that I am to use String Manipulation (Multi Column) and I am using this formula…
replace($$CURRENTCOLUMN$$, “-”, “”, “w”)
But it is not searching for Exact Matches.
Meaning it is also changing my data that has eg. “Planner - No” to “Planner No”.
I am only looking to change all Exact Matches, entire Cell = “-” to change to blank cell.
Thank you so much!
I was trying to figure our the regex language but was struggling ):
Thanks for sharing!
I managed to change some columns but I have this error for certain Columns. ERROR String Manipulation (Multi Column) 4:286 Execute failed: Execution stopped: Evaluation of expression failed for row “Row0”: java.lang.NullPointerException
Hi @ArjenEX !
I figured out the error – it was due to “missing values” and I resolved it by using a Missing Value node before the String Manipulation Node to resolve all missing values before running the regexReplace($$CURRENTCOLUMN$$,“^-$”,“”) to convert all exact cell matches “-” to blank.
Hi @neekstressed , you don’t need to use the Missing Value node to convert the missing values into empty string - the Missing Value node is quite slow, because of PMML.
You can just use the toEmpty() function in your expression. You can use it like this: regexReplace(toEmpty($$CURRENTCOLUMN$$), "^-$", "")
Can you explain a little on the expression?
regexReplace(toEmpty($$CURRENTCOLUMN$$), “^-$”, “”)
I understand toEmpty same as ismissing – so wouldnt it mean that we want the expression “to replace, empty current columns” ?
Do you know how I can better understand Regex language?