using System; using System.Text.RegularExpressions; namespace RegExApplication { public class Program { public static void Main(string[] args) { var pattern = "^([A-Za-z0-9_]{4})_([A-Za-z0-9_]{4})$"; var template = "ZZZZ_ss16"; var replaceWith = "${1}0%$2"; var regex = new Regex(pattern); Console.WriteLine(regex.Replace(template, replaceWith)); } } }