Gmail – Create Gmail filter for subject lines containing UTF-8 special characters

gmailgmail-filters

Lately I'm receiving a lot of spam that contains animations in the subject lines. Here is an example, from the source of a message, of a subject line containing animating fireworks.

Subject: =?UTF-8?B?876toA==?=Zero APR. No Credit Required. No Spend Limit!=?UTF-8?B?876toA==?=

I'm trying to create a Gmail filter that will automatically delete these kinds of messages with the fireworks in the subject line.

But I can't get this to work. I've tried filtering on subject text such as:
=?UTF-8?B?876toA==?=
or
876toA==

but this doesn't catch these emails. Does anyone know how I can create a Gmail filter that will successfully match these messages with special UTF-8 characters?

* Update 2015-07-27 *
See here for an example of the full message source for one of these spam emails. I've replaced my name and email address with '[redacted]'.
https://gist.github.com/anonymous/cfd57dcf6d3e87203295

Best Answer

You can use Google Script to perform exact matches in Gmail.

See: Advanced Gmail Filters with Apps Scripts

function filterGmail() {
  var threads = GmailApp.getInboxThreads();
  for (var t in threads) {
    var subject = threads[t].getFirstMessageSubject();
    if(subject.match(/REGEX HERE/) {
      // DO SOMETHING
    }
  }
}