use regex pattern '^12(?=.{4}$)' to remove digit 12 if followed by 4 other digits in column `c_contofficeid` of dataframe `df`,"df.c_contofficeID.str.replace('^12(?=.{4}$)', '')"