Trying to use Column Rename (regex) to remove the attachment of a column name e.g. “(Iter #123)”.
Did with (Iter #…). removed almost everything, only the first bracket always remains with the column name.
How do I get rid of the first bracket as well?
You need to add $2 in the Replacement field for the solution to work.
BUT given what you’ve just posted I’m not sure I quite understood your request. Can you give the above a go and if a different solution is required we can work through it from there.
The problem is that there are duplicate column labels and in the process e.g. (Iter #123) is appended to the duplicate column. Example: Column 1: Ecosystem; Column 2: Ecosystem (Iter #123). This is ok, because the database cannot work with duplicates.
But I want to export the data to Excel and remove “(Iter #123)” with Column Rename (regex) before.
I hope now a little more understandable.
Greetings
Bernd
PS: I had done that with $2, result: in picture 1 with yellow background
Understaood but you’re still in the same boat with KNMIE, you cannot have duplicate column names. So if you had
Test
Test (Iter #123)
If we try and remove (Iter #123) it will fail as you cannot have 2 columns called Test.
The change in theory is:
(.*)(\s\(Iter\s\#\d+\)) replace with $1
Essentially taking anything literal of (Iter # along with any number of digits followed by a literal ) and replacing this with the string beforehand, the 1st group.
I think your solution here is to unpivot the columns which need renaming, rename those values now in a row and then pivot it back to a table essentially merging the renamed rows back into a column but this doesn’t feel like it’s going to work unless the values are uniquely in only 1 of those columns. We could also look at merging those columns Column Merger – KNIME Hub
Does this help?
Do you have a sample of the dataset we could have a look at?