How to replace A01 with A1?

Hi, Im new to Knime and would really aprreciate your help!

I have a column with A01, A02…A10, A11…
I need it to be A1,A2…A10,A11…

Does anyone has a suggestion how this can be achieved? Preferably with changes that you apply in “configure”

Hi Emeright,

first of all we would like to welcome you in the KNIME Forum! If you you really have this consistent pattern (A01, A02,…A10, A11 etc.) you can use the column expression node (see attached workflow) and use the regexReplace method which replaces in this case every occurence of “A0” with “A”. Hope this helps :slight_smile:


ReplaceA0.knwf (6.1 KB)


Hello Iaaaarsi,

Thank you very much! Wow, I was not expecting to have a response this fast! This is a great community!
I have not explained my case properly as I think you have guessed. My pattern actually goes:
A01,…A10,…A12, B01,…B10, B11, B12… and so on till H12
My supervisor has fixed it with Python Script Node:

import pandas as pd
import string, os

new_pos_list =
plate_list =

for index, row in df.iterrows():
well = row[‘Well’]
if well[1] == ‘0’:
well = well.replace(‘0’, ‘’)

df.insert(1, “New_pos”, new_pos_list, True)
output_table_1 = df.copy()

Thank you very much though!
Best regards,

1 Like

Hello @Emeright,

if you explained it properly this time (:smile:) then this regex in String Manipulation or above mentioned Column Expressions node does the trick (recommend the former as it’s faster):

regexReplace( $column1$, "(.)0(.)" , "$1$2" )

And you don’t have to use Python and/or involve your supervisor :smiley:



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