Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>First of all, this is a tricky task.</p> <p>You should collect typical responses from different e-mail clients and prepare correct regular expressions (or whatever) to parse them. I've collected responses from outlook, thunderbird, gmail, apple mail and mail.ru.</p> <p>I am using regular expressions to parse response in following manner: if expression did not matched, I try to use the next one.</p> <pre><code>new Regex("From:\\s*" + Regex.Escape(_mail), RegexOptions.IgnoreCase); new Regex("&lt;" + Regex.Escape(_mail) + "&gt;", RegexOptions.IgnoreCase); new Regex(Regex.Escape(_mail) + "\\s+wrote:", RegexOptions.IgnoreCase); new Regex("\\n.*On.*(\\r\\n)?wrote:\\r\\n", RegexOptions.IgnoreCase | RegexOptions.Multiline); new Regex("-+original\\s+message-+\\s*$", RegexOptions.IgnoreCase); new Regex("from:\\s*$", RegexOptions.IgnoreCase); </code></pre> <p>To remove quotation in the end:</p> <pre><code>new Regex("^&gt;.*$", RegexOptions.IgnoreCase | RegexOptions.Multiline); </code></pre> <p>Here is my small collection of test responses (samples divided by <strong>---</strong> ):</p> <pre><code>From: test@test.com [mailto:test@test.com] Sent: Tuesday, January 13, 2009 1:27 PM ---- 2008/12/26 &lt;test@test.com&gt; &gt; text ---- test@test.com wrote: &gt; text ---- test@test.com wrote: text text ---- 2009/1/13 &lt;test@test.com&gt; &gt; text ---- test@test.com wrote: text text ---- 2009/1/13 &lt;test@test.com&gt; &gt; text &gt; text ---- 2009/1/13 &lt;test@test.com&gt; &gt; text &gt; text ---- test@test.com wrote: &gt; text &gt; text &lt;response here&gt; ---- --- On Fri, 23/1/09, test@test.com &lt;test@test.com&gt; wrote: &gt; text &gt; text </code></pre> <p>Best regards, Oleg Yaroshevych</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload