Hi
Firstly, I am a newcomer to knime and wow, what a great product. Can’t believe I was unaware of such a great resource.
I have been successfully importing and manipulating text files for further processing, but I have hit a brick wall trying to replace a curly double quotes with straight quotes eg I would like “ to be transformed into ".
I can successfully match the curly quotes using the character itself or its unicode but I can’t replace them with straight quotation marks. I have tried multiple nodes - string manipulation (replace and regex replace) as well as string replacer and string replace dictionary nodes.
I have tried escaping them in every possible combination I can think of and after 8 hours of getting nowhere I need your help! I can successfully replace single curly quote marks, but there is something about the double quotes in the replacement text that isn’t working for me.
eg regexReplace($Col0$,"“" ,""" ) finds and replaces the curly quotes with nothing.
In case it helps anyone else I have realised that my problem was due to a setting in the csv writer, not the find and replace expression. When I switch off quote mode (select the never option), I can replace curly quotes with straight ones - using the method you suggested and the other approaches.
Hi @gbarcan, Glad you found the root issue, however given your example using regex regexReplace($Col0$,"“" ,""" )
I suspect the reason this didn’t work is because the 2nd quote terminated the replacement, in fact I would expect the node to error out.
Something like below would probably have worked where the backslash (\) is used to escape the quote mark in the regex. regexReplace($Col0$,"“" ,"\"" )
I’ve not yet needed to use regexReplace, but most implementations of regular expressions would require some “escape character” in the same circumstance.