I would opt for a Regex positive lookahead in this case.
regexReplace(column("Column"),"[\\s](?=(IPsec:))","\n")
Output:
Reference: regex101: build, test, and debug regex
Make sure you take along the Java compatible version from regex101 to KNIME by using the Code Generator, Java and the contents of the final String regex
Next to strip
, can also recommended the removeDuplicates()
function. I often nest them as well for the most optimal result. For example,
strip(removeDuplicates(regexReplace(column("Column"),"[\\s](?=(IPsec:))","\n")))
Hope this helps in some way!