String replace question

Hi,
I have this following string “Column(0)Column column1 Column(2) This is the title”.

Trying to remove Column(0) etc. with this regular expression. Not working. Can you help?

TestString1.replace("Column* ", “”)

Thank you,

Hi @A_Learner ,

To use regex on String Replacements, you need to tweak your expression a bit as following:

System.Text.RegularExpressions.Regex.Replace(str_YourText,str_regexExpression,String.Empty)

As per your example:

System.Text.RegularExpressions.Regex.Replace("Column(0)Column column1 Column(2) This is the title","Column\(\d+\)",String.Empty)
  • This will remove all the occurrences of Column(anynumber), but not the rest of columns:

image

Hope this helps!

BR,
Ignasi

1 Like