Format and replace the first letter of the string

Hi, I have a text column with special code like this A0574JACP, 00928TFM, TF4882JZF, 04300FJTT.

I want to replace the first 2 letters of the text with the 3 letters “BAR” in front (eg BAR574JACP, BAR928TFM, BAR4882JZF). If I use a template replacement method, it would replace the other similar in the string.

Hope anyone could help please. Thanks!

You can do it like this.

return 'BAR' + p1.slice(2);
3 Likes

Using the Replace All plugin column:

4 Likes

Using AI:

1 Like
  1. Use a Text Slice column to slice the special code and remove the first 2 digits.
  2. Use a Template column to prefix the sliced text with “BAR”.

1 Like