I want to strip off the 're:' off subject lines in emails:
My string helper extension does the following:
return Regex.Replace(value, "([re:][re :])", "",RegexOptions.IgnoreCase);
However, it seems to match on "re :", but not "re:".
Is there any reason for this and how do I go about fixing it?
You probably mean something like:
Which can also be written as:
And here is a possibly better expression:
Which only matches at the beginning of the string (
^) and also removes any following spaces (\s*).