Creating Advanced Filters
Previous Microplanet Gravity Next |
You can take filters to a higher level and specify conditions like: From or Subject contains.., use PCREs, how many days old, in a watched/ignored thread, the article score, the number of lines, and more. Here is an example advanced filter:
Not Posted > 2 days ago And ( Score > 0 Or Subject contains reg. expr. "\bPorky\b" )
How-To access Advanced Filter Conditions
1. Click the "Filter" button on the filter bar , or go to Newsgroup - Define Display Filter
2. Select "New" or "Edit" and you will see the "Create New or Edit Filter" window. You can set the basic conditions (read, unread, or all articles, etc) now or later.
3. Select the "Advanced" Button to access the advanced conditions.
The Advanced Editor is similar to the Rules Editor . However, the following do not NOT work in filters:
· A condition in the article BODY
· (%s for user-specified text)
Tip: You can click in the conditions window to edit text directly. You can also use CTRL-C/V/X to copy, paste, and cut in the window. Remember that the condition ’ s text must follow certain syntax rules, so this is useful when you want to make small changes without having to remove and add the entire line again.
Text Entry
You can enter text strings in plain text (no wildcards) or as regular expressions (PCREs). Note that you have options to filter From, Subject, or Headers (not BODY).
Ø You also have a choice if the component DOES or DOES NOT contain the string, as shown above.
Ø Note: If you use a Regular Expression, you MUST remember to check the "Regular Expression" box.
Remember, you can NOT use the body, even though it is in the list. The "headers" are limited to From, Subject, and Message-ID (and date, but that is difficult to use).
If you want to include Message-IDs, use the Header Condition (however, if the email and MID domain are the same, you will get matches from both, unless there is a way to distinguish between the two).
Note that the brackets are part of the Message-ID string. The bracket is only of concern if you try to anchor a PCRE at the end/start of line. This will not work:
Header contains reg. expr. "@.+\.googlegroups\.com$" FAILS
But the following does work:
Header contains reg. expr. "@.+\.googlegroups\.com>$"
Adding Conditions
You must remember to "Add Conditions" with the button. You can add as many conditions as you like. Conditions are combined with simple Boolean AND/OR/NOT logic. Where text entries are used, you can use plain text in one condition, and a regular expression in another. You can group and nest expressions with parentheses.
There is no limit to the complexity, except your own ability to follow the logic and match parentheses in nested levels.
You must use the appropriate AND/OR logic expressions. As an example, we will create a filter that shows posts From "frag" OR contains "gravity" in the Subject. Either condition can be true. Our conditions would look like this:
Subject contains "gravity" Or From contains reg. expr. "\bfrag\b"
In this filter we used plain text for "gravity" in Subject, and a regular expression for "frag" in From.
Filtering on the "From" Header
Even though Gravity only shows the full name part of the "From:" header in the display, filters will also act on the full name OR the address part. Consider this email address:
Tom B. <nfn03862@naples.net>
Gravity shows " Tom B. " in the display. You could also filter on " nfn03862@naples.net" " nfn03862 ” or " naples.net " or " <nfn " as well as " Tom B. "
As with the Message ID, the brackets (< >) are included the address part.
You can not filter on both parts together in the same string. This will fail: " Tom B. <nfn " However, you can do the following to match both parts , if required.
From contains reg. expr. "Tom B\." And From contains "nfn03862@naples.net"
(with or without the brackets in the address part)
"Less Than" Conditions
You may notice, there is no "Less than" condition. However, you might need this if you work with the these filter conditions.
· Article was posted more than xx days ago
· Article has more than xx lines
· Article score is more than xx
Suppose you want to filter articles posted less than xx days ago, or have less than xx lines, or the score is less than xx. There is no apparent way to do this. This is a frequently asked question. The solution is to invert the logic with NOT in the logic like this:
Not Lines > 300
If you are grouping one of these with other conditions, you might need parentheses like this:
( Not Lines > 300 )
For more examples, see How-To Use Scores in Filters