I'm trying to work out how to use the Regex.Replace method for my needs, basically I need to find a particular word which doesn't have any "a-z" letters either side of it and replace only the matches with another word.
In the example below I search for all "man" occurrences and replace with "coach". I use this regex pattern "[^a-z](man)[^a-z]" which does capture what I want.
//String to search
"The man managed the football team"
//After using Regex.Replace I expect to see
"The coach managed the football team"
//But what I actually get is
"The coach coachaged the football team"
\sman\s?managedfor me.Regex.Replace("The man managed the football team", "[^a-z](man)[^a-z]", "coach")=>Thecoachmanaged the football team, because you also replace the spaces around man.