Avatar of Misha
Flag for Russian Federation

asked on 

C# Regex

Please help me with regex in C#.

I need to find "i"  and replace it.

My code
 string input = "i,for (EntityReader,i,new, (i), i<i, ArrayList<String>()))i";
 string pattern = "[)(, -=<>+](i)";
 string outPut = Regex.Replace(input, pattern, "j");

Open in new window

Expected result is
j,for (EntityReader,j,new, (j), j<j, ArrayList<String>()))j

But I get this:
i,for (EntityReaderj,new, j),jj, ArrayList<String>()))i

The symbol before "i" is lost. And I can not find first and last "i".
Regular ExpressionsProgrammingC#

Avatar of undefined
Last Comment

8/22/2022 - Mon