I have the regex:
TheComment = Regex.Replace(TheComment, "(\\@" + r + "\b)", "<span style=\"background:yellow;font-weight:bold;\">@" + ThisUser.Username + "</span>", RegexOptions.IgnoreCase);
This is an example pattern
(\\@to\b)
I want this to match @To but not @Tom. At the moment it’s not matching, if I strip the \b away it works but it matches @Tom as well which is musn’t.
You have to escape
\and not@. Plus, you got to move\bout of the selection.