Renaming a column based on a condition

I am working on a file where I sometimes receive a file with column name let’s say either:

‘Column (Name)’

but I only want it to be named only ‘Column’ everytime

what node should I use, if for example I received the file with ‘Column’ THEN no need to rename
but IF ‘Column (Name)’, THEN should be renamed to ‘Column’

I already tried it using a Rule Engine, but I dont think it is possible, since it can only alter values on columns.

Thanks in advance.

Hi @rpaulorodio & welcome to the KNIME forum

This can be easily done using a -Column Rename (Regex)- node:


Please be aware that column names must be unique and therefore this is only valid if you have ONLY one column named “Column (something)”. For instance, this solution would not be valid if you have two columns named “Column (#1)” and “Column (#2)”.

Hope it helps.



Thank you! It worked! I was considering this solution before posting but don’t know how to write in Regex form and hoping for another solution, but this would suffice. :slight_smile:


@rpaulorodio Glad it worked and thank you for validating the solution.

Best wishes with your KNIME projects !


1 Like

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