Skip to content

Instantly share code, notes, and snippets.

@devstator82
Created February 12, 2013 06:35
Show Gist options
  • Save devstator82/4760643 to your computer and use it in GitHub Desktop.
Save devstator82/4760643 to your computer and use it in GitHub Desktop.
// Search for reply text for messages from inbox2: ------Reply Message-----
int indexOfStartReplyText = source.IndexOf("---------- Reply message ----------");
if (indexOfStartReplyText >= 0)
return source.Substring(0, indexOfStartReplyText);
// Search for reply text for messages from GMail: <blockquote class="gmail_quote"
indexOfStartReplyText = source.IndexOf(@"<blockquote class=""gmail_quote""");
if (indexOfStartReplyText >= 0)
return source.Substring(0, indexOfStartReplyText);
// Search for reply text for messages from Hotmail: <br><br><hr id="stopSpelling">
indexOfStartReplyText = source.IndexOf(@"<br><br><hr id=""stopSpelling"">");
if (indexOfStartReplyText >= 0)
return source.Substring(0, indexOfStartReplyText);
// Search for reply text for messages from Outook: <div style='border:none;border-top:solid #B5C4DF
indexOfStartReplyText = source.IndexOf(@"<div style='border:none;border-top:solid #B5C4DF");
if (indexOfStartReplyText >= 0)
return source.Substring(0, indexOfStartReplyText);
// TODO: Search for reply text for messages from BlackBerry: ?
// Search for reply text for messages from Iphone Default Mail Client: On [DATE AND MORE] [NAME] wrote:[BODY]</blockquote>
return Regex.Replace(source, @"\bOn\W+(?:\w+\W+){1,200}?wrote\W+(?:\w+\W+){1,}?</blockquote>",
"", RegexOptions.IgnoreCase | RegexOptions.Compiled);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment