DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
C# Regex Replace
For replacing matches with different strings. The method 'MethodName' will have Match object as the only paramater. 'MethodName' will be executed for every match in fileContent.
string replacement = Regex.Replace(fileContent, @"pattern", new MatchEvaluator(MethodName));