string input = TextBox1.Text; Dictionary<string, string> map = new Dictionary<string, string>(); map.Add("go", "GYO"); map.Add("GO", "OMO"); map.Add("Go", "OIO"); string temp = input; foreach (var entry in map) { string key = entry.Key; string value = entry.Value; temp = Regex.Replace(temp, key, match => { bool isUpper = char.IsUpper(match.Value[0]); char[] result = value.ToCharArray(); result[0] = isUpper ? char.ToUpper(result[0]) : char.ToLower(result[0]); return new string(result); }, RegexOptions.Compiled);
Tried all RegexOptions
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)