The application I maintain sends error emails to me, which contain a build number and a description of the failure. I want to be able to search for specific messages from specific builds but Gmail doesn't seem to handle this properly. I have tried:

NullPointerException 12B -12A

to find emails for NullPointerExceptions that occurred in build 12B, and exclude those that came from build 12A. This search returns all NullPointerExceptions that came from EITHER 12B or 12A. I tried various grouping operators and nothing seems to work.

If I just search for 12B -12A it correctly doesn't show any 12A emails, but as soon as I add "NullPointerException" it starts finding all the NullPointerException emails ever.

  • Are all these terms in the body or subject of the message ?
    – phwd
    Commented Jul 8, 2010 at 14:49
  • The NullPointerException part is in both and the build numbers are only in the body. Commented Jul 9, 2010 at 13:01

3 Answers 3


Try (NullPointerException AND 12B) -12A


Import the set of email messages that you want to search in Mozilla Thunderbird. Install the ImportExportTools add-on and use it to export the messages locally to a searchable format. Now use whatever search tool you like, for instance grep, to search your local repository.

It's a bizarre and tedious solution, but hey it works. And there seems to be little else one can do.


You can do this by wrapping the - within literal quotes.

NullPointerException 12B "-" 12A


NullPointerException 12B "-12A"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.