Say for example I have the following string \"one two(three) (three) four five\" and I want to replace \"(three)\" with \"(four)\" but
\"one two(three) (three) four five\"
\"(three)\"
\"(four)\"
Here a simple code you may be interested in:
string pattern = @"\b" + find + @"\b"; Regex.Replace(stringToSearch, pattern, replace, RegexOptions.IgnoreCase);
Source code: snip2code - C#: Replace an exact word in a sentence