Replace multiple string to one

Hello i have a question. I want to replace multiple strings if one of them exists “FIRST”, “ANOTHER”,“SECOND” to “NEWNAME” in text document (.txt). I know how to do that with one string with regex method and replace string method, but how to add multiple pattern with OR function?

Hi @sjankus,

use below code

stringvalue=stringvalue.Replace("1", string.Empty).Replace("2", string.Empty).Replace("3", string.Empty)


@sjankus Try below file. It will be helpful.

ReplaceText-----.xaml (8.7 KB)


The @Manjuts90 example works perfectly!
Thank you all!

1 Like