using System.Text.RegularExpressions;
public static class RegexEx
{
public static string ReplaceEx(this string input, string pattern, string replacement)
{
return Regex.Replace(input, pattern, replacement);
}
}
string line = "123";
string result = line.ReplaceEx("1", "111").ReplaceEx("2", "222").ReplaceEx("3", "333");
Console.WriteLine(result); // 111222333