You should use Regex (I updated the tags in your question to reflect this):
Regex.Replace(text, @"src=""cid:(?<FileName>[^@]+)@[^""]*""", @"src=""Attachments\${FileName}""",
RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
Regex.Replace(x, @"alt=""[^.]*cid:(?<FileName>[^@]+)@[^""]*""", @"alt=""${FileName}""",
RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
I'm sure there are more effective ways to do this, but this is what I could come up with.
source
share