1. Computing

Discuss in my forum

How to Search for Mail Using Regular Expressions in The Bat!

By

It is an R you seek, followed by an E and then a colon, followed, after however much white space there is, by another R and E, or followed by an F, perhaps, and a W and D?

Using The Bat!'s regular expression matching, you can compose patterns like these and have The Bat! return all the messages that fit.

Perl-style regular expressions as used in The Bat! can become highly complex and it's easy to make mistakes, but there's also the surprisingly simple and fast solution to the odd search problem.

Search for Mail Using Regular Expressions in The Bat!

To use Perl-style regular expressions to find mail in The Bat!:

  • Select Tools | Search… from the menu in The Bat!.
  • Make sure you are on the simple search interface's Options tab.
    • If you can see a Simple button on the right, click it.
  • Make sure Any part is selected for the search's scope.
  • Make sure match is picked next to it.
  • Enter the desired regular expression in the search field.
    • See below for a few examples.
  • Click Start.

Regular Expression Email Search Examples

Here are some simple examples for searches you can concoct using regular expressions in The Bat!:

  • (?i)^from:.*you@example.com - Finds all mail from you@example.com (you can get this query much easier with standard search, of course).
  • (?i)^x-spam-score:\s*[7-9] - Finds mail with an X-Spam-Score header of 7, 8 or 9.
  • (?i)^subject:(\s*(re|fwd?)(\[\d*\])?:\s*){2,} - Finds emails with subjects that have "Fwd: Re[2]: Re:", "Fwd: Fw:" or similarly repeated classifiers in the subject line. (You can also have your template for replies strip the duplicates from your messages.)

©2014 About.com. All rights reserved.