I'm trying to create a function replacing only whole words, for example:
The sentence : "#testing is #test", if I use Replace("#test", "#cool"), I'll have "#cooling if #cool" but I'd like to have "#testing is #cool"
I've searched and every answer found was :
string pattern = @"b"+previousText+"b";
string myText = Regex.Replace(input, pattern, newText, RegexOptions.IgnoreCase);
However this solution does not work if my previousText (the one I'd like to replace) contains a "#".
Both my previousText and my newText can start with a "#".
What is the solution for this ?
