regex replace not catching newline

Hi, this is my first post, so I hope I’m placing this in the correct area.
I’m trying to use regexReplace in string manipulation on KNIME 4.5.1

regexReplace($JSON$,"\{\r\n\s"scales", “,\r\n"scales”)

the column has string as follows:

}, {
“scales”: {

I can match on ’ "scale’ . But as soon as I try and catch the previous line’s CRLF it doesn’t match

thanks in advance

Hello @anoopchawla
Have you reviewed this topic?

Maybe some provided solutions match for your challenge.



Thank you for the quick response. A little more debugging revealed i missed catching an extra space (\s\s"scales)

but I’ll remember this multiline split strategy you referenced.


1 Like

regexReplace($JSON$,"(\s\“scales)”, "(“scales)”)
(output contains \ after n)


regexReplace($JSON$,"(\\\\s\“scales)”, "(“scales)”)
(output does not contains \ after n)

The " before scales won’t register correctly without an escape character ()

Screen Shot 2022-03-14 at 12.06.50 PM

1 Like

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