Replace just an exact word in C#
Same as String.Replace but with case-insensitive matches and search for the exact word.
post this code
public static string ReplaceExactWord(this string stringToSearch, string find, string replace)
string pattern = @"\b" + find + @"\b";
return Regex.Replace(stringToSearch, pattern, replace, RegexOptions.IgnoreCase);
If you want to be updated about similar snippets,
and follow our Channels