I have a string that I would like to apply regex pattern and replace a part of it. I am able to accomplish some part of what I would like to do. My code is:
var str = "license plate matching AMC1";var result = Regex.Replace(str, "matching|matches|match", $"like");var result1 = Regex.Replace(result, "[a-zA-Z0-9]+$", "\'%$1%\'");Console.WriteLine(result1);
I would like to replace the substring AMC1(an alpha numeric) with '%AMC1%'. How do I accomplish this?