I need to replace only if the string
has an exact match. How can I do this ?
At the moment it replaces the string expression if it matches any part of the string.
string strExpression = "hey! Hello World. SpecialDayForMe";
strExpression = strExpression .Replace("SpecialDay", "ABC") ;
The result of the strExpression
is "hey! Hello World. ABCForMe"
.
What I want it to ONLY match if there's a match of SpecialDay
in the string and not for a partial match. How can I do this ?
Note: Would be great if I can do this without using REGEX.