I need to find all the words containing some string. For example "team" and replace it with another string. The string will as a substring for example:
- team of experts
- team manager
- A big team
I need to replace all those places with the string "hlhl$$@team".
I use the regular expression:
String exp= String.Format("({0}\\s)|({0}$)", "team);
The problem is that strings that are already are "hlhl$$@team" match the regular expression and are being replaced to "hlhl$$@hlhl$$@team"
How can I ignore those strings that start with hlhl$$@?
Thanks.
Regex.Replace(s, @"(?<!hlhl\$\$@)\bteam\b", "hlhl$$$$@team")