Changing singular letter to null

Hey guys,

I’ve recently started to learn knime and come across a problem. Effectively I need to remove singular alphabet value from a cell, which rage from A-Z and I’m not sure how to go about this. Essentially what I’m saying is I have values in a column such as … HJ KL A EE AA QQ UU P. So in this instance I would like to remove the “A” and “P” and keep the others… How can I do this?

Hi @Mustafa_06

Welcome to the forum! One way to achieve this is by doing a RegexReplace where the regex searches for single letters only and replaces them with a blank. As such, by using duplicates() any double spaces get cleaned up as well.

a = regexReplace(column("column1"), "\\b([A-Z]{1})\\b", "")
b = removeDuplicates(a)

If you do not have the Column Expression node, drag and drop it into the workflow (it’s a very useful node to have) Column Expressions – KNIME Hub


Thank you! It worked perfectly

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