<div class="markdown">
<p dir="auto">On 11 Feb 2016, at 14:42, Ale Muñoz wrote:</p>
<blockquote>
<p dir="auto">Here's what I want to do:</p>
<ul>
<li>Take the subject from the selected email</li>
<li>Extract some information from it using a RegExp</li>
<li>Search the current mailbox for all emails that contain that RegExp and delete them</li>
</ul>
<p dir="auto">Any ideas? Thanks in advance! : )</p>
</blockquote>
<p dir="auto">This is actually possible using custom key bindings, but it appears it's only documented in some very old release notes. I've noted to make sure it's documented:</p>
<p dir="auto">Here is an example:</p>
<pre><code>( "selectWithFilter:", "subject ~ '${subject/[^\\d]*(\\d+).*/$1/}'", "deleteMessage:" );
</code></pre>
<p dir="auto">In this case I'm extracting the first number found in the subject line of the currently selected message. All subject lines in the current mailbox are then searched for the same number.</p>
<p dir="auto">Observations:</p>
<ul>
<li>It's tricky to debug. I suggest using the format/regexp string for one of the menu bar counters until the menu displays the values you need to extract. Then make sure you escape (add another <code>\</code>) any uses of <code>\</code> before adding it to the key bindings file.</li>
<li>It's badly named. It should be <code>selectWithFormatString:</code>. I've added that this also works.</li>
<li>It doesn't allow you switch mailbox before selecting messages (not easily fixed).</li>
<li>The above example would also match on substrings of numbers.</li>
</ul>
<p dir="auto">But it seems it should work for you.</p>
<p dir="auto">-- <br>
Benny</p>
</div>