I want to create a small tool to convert some code.
Most of it can be done by Regex, so I do not need an actual parser.
But there is a problem with repeating patterns. Below a simplified sample:
var nl = Environment.NewLine;
var temp =
@"Other things
End
End
Other things";
temp = Regex.Replace(temp, @"(\r\nEnd\r\n)+",@"" + nl + "}" + nl + "");
This will return
Other things
}
End
Other things
So the second End is not replaced. (except if I execute the same Regex.Replace twice)
Any idea how to solve this?
Best regards