You are on page 1of 11

Expression Search / GMailUI is an extension to Thunderbird (versions 5.

0+) which add powerful


message searching features. Init by Ken Mixter, Maintaining by Opera Wang.
Type "hello world" to search within the current view for this string in subject/from/to/cc.
Type "from:fred to:tom attachment:yes" to see all messages from Fred to Tom in the current view
that have an attachment.
Press Ctrl+Enter to have this search apply to all folders through virtual folder.
Press Shift+Enter to invoke Gloda Search in all indexed folders.
Use Ctrl/Shift+Right Click to search the clicked subject/From/Recipient.
Expression Search's features are described below.

Search expressions and quick search key


This extension adds a new search text box to the end of your quick search bar. Whatever phrase
you enter is searched for in your currently selected folder's to/from/cc/subject fields. Notice that
by default the body is not searched for your search phrase. If that results in too many
matches,you can focus the search using "operators". Operators are just short words followed by a
colon, such as "from:amazon.com".
Here are some examples:
1. weekend plans
This expression searches all messages in the current folder or view for 'weekend plans' in
the from, to, cc, or subject fields.
If "Act as normal filter" enabled, the "Sender", "Recipients", "Subject" and "Body"
buttons will determine to search in which fields.
2. from:mike or f:mike
This expression searches all messages in the current folder or view for 'mike' in the from
field.
3. to:bill or t:bill
This expression searches all messages in the current folder or view for 'bill' in the to or cc
fields of the message.
4. tonocc:bill or cc:tom or bcc:riddle
Like above, tonocc will search to field only, cc/bcc will search cc/bcc field only. Case
insensitive.

5. only:tom or o:tom
Search for 'tom', and 'tom' should be the only recipients in to filed. Case insensitive.
Note: 'only:(tom or jerry)' will get message that to filed is 'tom' or 'jerry' only, while 'only:
(tom and jerry)' will get nothing, please use 'only:(tom,jerry)' instead if you want to
search emails that recipients contain and only contain both 'tom' and 'jerry'.
6. subject:electric bill or s:electric bill
This expression searches all messages in the current folder or view for 'electric bill' in the
subject fields of the message. Case insensitive.
7. simple:this subject contains special characters like ( ) ' " - etc
This expression searches all messages in the current folder or view in the subject fields of
the message. And the pattern can contain special characters. unlike "subject" search, this
search won't suffer from Bug 124641.
This pattern must be the last pattern. Case sensitive.
8. regex:/^begin/i or re:end$ or r:/\d+\s*\d+/
This expression searches all messages in the current folder or view with Regular
Expressions in the subject fields of the message.
This pattern must be the last pattern. Case sensitive unless you have //i.
9. headerre:List-Id=/all-test/i or h:list-id or h:sender=/^Bob/ or hr:header~/^value/
This expression searches all messages in the current folder or view with Regular
Expressions in the header of the message. The header should be already saved in
Thunderbird's .msf database. You can config the headers in 'options/Search More
Headers', If you added one header, it will only affect newly added emails unless you do
'repaire folder'.
This pattern must be the last pattern. Header is case insensitive, Value is case sensitive
unless you have //i. If the value is empty, Any message has the header will match.
10. attachment:yes or a:yes
This expression searches all messages in the current folder or view for an attachment,
Notice that it does not search for attachments named "yes". You can also use "y" or "1"
for "yes". You can use "no", "n", or "0" to search for messages without attachments.
11. filename:foo.doc or fi:image or fn:msword or file:html

Experimental Feature, Use it with caution, better SAVE ALL DRAFTS before using it,
may crash Thunderbird. This expression searches all messages in the current folder or
view for an attachment name or type. Case insensitive. If you just want to search
messages that have attachement, use attachment:yes instead of using this one.
12. is:replied or i:UnRead or status:Forwarded or status:F
This expression searches all messages in the current folder or view for status, The status
can be one of Replied, Read, Marked, Forwarded, UnRead, New, ImapDeleted or
Attachment.
13. before:2011/03/09 07:12:00 or be:09 Mar 2011 05:00:00 or after:Mar 10, 2011 or af:
(2011/03/01 -2011/03/09)
This expression searches all messages in the current folder or view within the date range,
The date format can be checked Here.
14. before:07:12:00 or be:5:9 or after:03:07:05 or af:(3:0 -4:0)
This expression searches all messages in the current folder or view within the time range.
af:(3:0 -4:0) will search for messages in current view that date between 3am to 4am
EVERY day.
15. date:2011/01 or date:2011/01/03 or d:" 03:" or in zh-CN locale d:2011 3
This expression searches all messages in the current folder or view to match date. The
internal format for compare is "yyyy/mm/dd hh:mm:ss", locale date is also supported.
16. ag:3 or da:3 or age:3 or older_than:3 or days:(3 -5) or age:today or
newer_than:8week
This expression searches all messages in the current folder or view to match age in days.
days:(3 -5) will search for messages that age between 3 to 5 days.
17. size:10 or si:(0.5M -2M) or larger:1G or smaller:1024 or sm:10
This expression searches all messages in the current folder or view to match size in KB or
MB/GB. size:(3 -5) will search for messages that size is larger than 3KB and less than
5KB, that is 4.x KB.
18. body:electric bill
This expression searches all messages in the current folder or view for 'electric bill' in the
body of the message. On large or remote folders it may take some time. Also, if you
combine this with other search operators like "from:", "subject:" or "to:" this will speed
things up considerably.

19. bodyre:/hello.*world/i or br:tb.*crash


Experimental Feature, Use it with caution, better SAVE ALL DRAFTS before using it,
may crash Thunderbird. This expression searches the body of all messages in the current
folder or view. Case sensitive and should be the last pattern. Use 'body:' instead of
'bodyre:' when possible.
20. label:Important or tag:TODO or l:NA
This expression searches all messages in the current folder or view which has the tag
Important. l:NA means all messages without tag.
21. all: weekend plans
This expression searches all messages in the current folder or view for 'weekend plans'
anywhere in the message, including the from, to, cc, or subject fields, and the body.
22. g: weather
This will call gloda (faceted) search if gloda enabled. This mode can't be used together
will other specifications like 'f:' or 't:'.
23. 3+2
If the expression looks like an arithmetic one, when you press enter, it will be calculated
and the result will be shown in the search box.

Hot Key
By default, Before TB8, Press Ctrl+F, your cursor will appear in the expression search bar or in
the "search in message" bar, depend on where current focus is, and you will be able to type. See
Bug 564328.
After TB8, the hot key was changed to "Ctrl+Shif+K".
Expression Search add one additional hot key "Ctrl+B", this will only focus your cursor in the
expression search bar.
Once you are typing in your search query, and you hit enter or otherwise let it begin searching,
your cursor will remain inside of the query box to allow you to modify the query. However, if
you'd rather go back to browsing your messages, instead of clicking on the message headers in
your search results, you can just press 'ESC' to to clear the search criteria, and press 'ESC' again
to refocus back

Quick Search Virtual Folder

If you haven't before used 'virtual folders' in Thunderbird, let me introduce them. This standard
feature of Thunderbird lets you create a search, name it, and then have that name appear in your
folders list. You can select that folder from the list and see the current result of the saved search.
Note two useful things: 1) the 'contents' of the virtual folder can actually be in any of your real
folders, and so a virtual folder actually can 'contain' messages that span many folders, and 2) the
virtual folder's contents are recomputed each time you view it, so if you saved a virtual folder
with 'sender' field containing 'Donald', then if you receive a new message from someone named
Donald, it will be placed in your INBOX, but you'll immediately be able to switch to your
Donald virtual folder, and find it there.
So that's what regular virtual search folders do in Thunderbird. But this extension makes it
extremely easy to create them. Now, when you normally hit 'enter' in the Expression search quick
search bar, you can instead hit 'ctrl-enter' and a virtual folder called 'ExressionSearch' will be
created (or modified if it already existed) to search for that search across ALL of your folders in
the current account.
The resulting virtual folder 'ExpressionSearch' can then be modified by editing properties, or can
be renamed to make it a permanent virtual search folder. If you do not rename the folder, the next
time you use ctrl-enter the ExpressionSearch virtual folder is reused to show your new quick
search result.
The option "Keep selected folders for saved search" to have the "ExpressionSearch" virtual
folder being persistent not only allows you to mark it as "Preferred" without the setting being lost
when restarting TB, but also you can edit the properties of the "ExpressionSearch" virtual folder
to specify once for all which of your physical folders should be searched or not with a global
non-faceted search (CTRL+Enter).
Where "ExpressionSearch" is created can also be set in the option dialog, By default, it's the root
folder of the current disaplyed folder
You can back to original folder by press Ctrl+LEFT

More complex searching


The quick search bar allows you use the simple expressions from above, but it also allows you to
compose more complex searches. For instance, if you want to search for a message from Bob
Barker to Dave Letterman about monologues, you can use:
f:Bob Barker t:Dave Letterman s:monologues
If you are tired of getting results that have jokes about "Monica", you can instead use:
f:Bob Barker t:Dave Letterman s:monologues -Monica
If you are interested in messages from either of these celebrities:

f:Bob Barker or f:Dave Letterman

Notes
Note 1: For the average user, the above information is usually adequate. If you are curious, this
feature still relies upon an underlying Thunderbird message searching mechanism. That
mechanism cannot always perform searches correctly that have a combination of boolean
operators. So, if you try to perform a search that mixes "ands" and "ors" you may get back too
many results. As an example, if you were to search for "t:dan and f:(bob or dave)" you will be
mixing boolean operators and the results may be over inclusive or may work. As an extra
technical note, if you did "t:dan and -f:(bob or dave)", DeMorgan's theorem takes place and you
are actually composing a search of "t:dan and f:-bob and f:-dave".
However, due to restrictions in Thunderbird's virtual search folder, the complex searching results
maybe correct in your current search results, but maybe NOT in you search folder. as the search
folder can only handle 'Match all' and 'Match any' types.
Note 2: If you want search all folders using expression, you can create a virtual folder manually
(Ctrl+Shift+F) with 'Match all messages', then using expression search in the virtual folder.
Note 3: In case you also using the normal search filter, the final results is logically "AND", that
means both filter are effective.

Click 2 Search
If Enabled, you can use Ctrl/Shift+Right Click on sender/recipient/subject column to search for
the same sender, recipient or subject.
For subject line, if provided regular expression match/replace patterns and enabled the replace
for corresponding key combo, the pattern will be first executed
Replace subject before search.
Multiple matches are ORed. Example:
Match:
\[#(\d*)\]
Replace: $1
Subject: [#1212][#2323]Some text
Result: (1212 or 2323)

Also common prefix like 'Re:', 'Fw:', [mail-list-name] will be removed before search.

Version history

Version 0.8.6:
o getCellProperties API change for TB22
o Add options for tooltip show/hide time

o change the flexibility of other element to make my search box bigger


o Add "Re: " to subject if it's a reply email for subject regex search
o Add 'Select All', 'Clear All' & select mode when modify virtual folder's folders.
o Fix bug: Donate through palpay directly not working because I'm in China

Version 0.8.5:
o Added options for show or hide text labels of 'quick filter' buttons
o Added options to seperate subject replacment for Ctrl/Shift+RightClick
o Added options for load Saved Search folder in a new Tab
o Added hotkey Ctrl+Left for back to original folder after Ctrl+Enter
o Added regex search for headers
o Added regex search for body(experimental, may crash)
o Added newer_than/older_than support
o Added size/larger/smaller support
o Support NA for tag search, Star for status search
o Added today/yesterday/day/month/year for days search
o Added status bar icon & tips
o Added donate buttons
o Added scrollbar for option window when needed
o Fixed crash issue when ctrl2search on headers
o Fixed bugs for Ctrl+Enter launch gloda search when no messages found
o Fixed bugs for pined quick search buttons not work when switch between folders
o Fixed bugs for transparent background help page on Mac OS

o Fixed bugs for click2search triggers context menu on Mac OS


o Compatible with TB5~TB23

Version 0.8.4:
o Added tonocc/bcc/cc/only/age search
o Added options for show verbose information
o Added options for where to create expression search folders
o Fixed '<>' in search pattern issue when use click2search
o Fixed search issue when use click2search and address is in address book
o Fixed hang issue when '\t' exists in search pattern
o Fixed minor bug that extension defined search terms show when search in address
book
o Fixed one bug that icons for quick search may missing when move search buttons
to menubar or toolbar

Version 0.8.3: Fixed context menu missing issue when click right button.

Version 0.8.2: Work with Thunderbird 5. Fixed search bar shown issue. Fixed issue when
search with complicated expressions.

Version 0.8.1: Fixed a bug: During search, 'Continue search with all folders' message will
shown.

Version 0.8:
o Work with Thunderbird 3.3.
o Added Click2Search similar to The Bat!
o Added options to move expression search box to toolbar/menubar
o Added options to act as normal search box
o Added options to select 1st messages after hit enter in search box

o Hit enter will launch gloda search if no message found


o Hit Ctrl+B will focus on search box
o before/after search can now search time within day
o Added simple/regex/date search
o Added filename for attachment name/type search (experimental, may crash)

Version 0.7: Added 'status/is' search. Added 'before/after' search. Added numerical
calculation.

Version 0.6: Added Help & Contact link to Options dialog.

Version 0.5: Added Options dialog.

Version 0.4: Work with Thunderbird 3.1 .

Version 0.3: Shift+Enter to launch gloda search. Fix 'Cc','Cu','Ci','Cr' redefine error.

Version 0.2: Added 'g:' search mode for gloda search. Press 'Esc' in thread tree will clear
the search criteria.

Version 0.1: First version, changed from GMailUI to make it works for Thunderbird 3.

Known Issues of this extension or Thunderbird

The "filename:" Search for filename/type in the attachment is experimental and may
crash your Thunderbird.

The "bodyre:" Search for regex in body is experimental and may crash your Thunderbird.

Shift+RightClick May not work for some versions of Thunderbird.

Bug 124641 - Thunderbird does not handle multi-line headers correctly when search term
spans lines

Bug 224392 - Add ability to filter by attachment name (extension)

Bug 338761 - searching body of emails for text doesn't match word-wrapped text

Bug 363238 - saved searches fail for searches on x-headers

Bug 546925 - custom header search is non-functional ('Run search on server' of


Edit/Find/Search Messages doesn't work any more)

Bug 564328 - Keyboard shortcut Ctrl+F conflict and cmd_find ambiguity, used for both
Find in This Message and Quick Filter

Bug 570815 - (qfwidget) Make Quickfilter optionally available as simple searchbox


widget+stickypin (with filter criteria in persistent popup panel &/or dropdown; toolbar
customization)

Bug 600140 - 'Unread' quick filter hides some unread messages (the beginning of a
thread)

Bug 607295 - Provide UI for new archive granularity and folder structure options

Bug 625472 - Quick search processes input after hiding it with escape

Compared with original GMailUI 0.6, these features are still missing:

Use 'Y' to archive selected mail to archive


folder (use 'a')

Use J/K to move messages up and down, and Ctrl+J to mark a message as junk (conflict
with builtin key mapping, use 'f/b' instead)

Key '/' focuses on the quick search bar (use Ctrl+F)

If you do need to change the hotkeys, please try other extensions below.

Other Extensions
You can try the following extensions to make your Thunderbird more convenient.

GMail Conversation View and How to display sent messages in Inbox?

Keyconfig

Nostalgy

Thanks

Ken Mixter - Original Author of GMailUI

savo_msu - Author of One Click Search

Kent James - Author of FiltaQuilla

Jiten Dedhia - Suggest for 'toonly' search

Greg Cowan - Suggest for date search

Mike Martinez - Suggest for bcc search

Olivier - Suggest for Shift/Ctrl+Enter

Paul Sednaoui - Suggest for 'only' search

Randolf Ebelt - Find a bug when search with complicate expressions

Olivier Brodeur - Find a bug when no messages found, gloda launched when Ctrl+Enter

Lee Yeoh - Find a bug for pined quick search buttons not work

Tom Zhu - Suggest for Enter to focus message pane, and validations before release.

Feedback, Suggestions, and on-going Development


Home Page: expression-search
Please send email to Opera.Wang+es@gmail.com for feedback, suggestions etc
Twitter or Weibo

You might also like