Discussion:
Any extant syntax to concisely describe pattern-matching for articles?
(too old to reply)
J.B. Nicholson
2020-04-05 07:10:19 UTC
Permalink
I need a way to concisely describe criteria to match a set of articles
in a newsreader. The criteria is given by the user ad-hoc at runtime
and would handle statements like:

* Subject header contains the substring "foo".
* Posted date is after 2010-10-05.
* Posted date is before 2015-05-11.
* From header contains the substring "bar".

Ideally this would be a textual syntax, something typed into a
freeform text entry space (like a command or a GUI text input
area). I'm hoping that someone has considered this and come up with
something that is easy to use, understandable, and functional enough
that one would want to use it. I imagine something like:

subject/foo
date>2010-10-05
date<2015-05-11
from/bar

Does any newsreader offer any syntax to let a user identify or select
a set of articles which match the given criteria?

If you know of such a thing, would you please point me in the
direction of the relevant published standard, documentation, or specs
for this syntax or functionality? I'd like to learn more about that
and avoid reinventing this wheel.

Thanks.
Eli the Bearded
2020-04-06 00:35:58 UTC
Permalink
Post by J.B. Nicholson
I need a way to concisely describe criteria to match a set of articles
in a newsreader. The criteria is given by the user ad-hoc at runtime
* Subject header contains the substring "foo".
* Posted date is after 2010-10-05.
* Posted date is before 2015-05-11.
* From header contains the substring "bar".
Are those supposed only be independing actions, or are you envisioning
a statement system that includes ORs or ANDs?

trn (and earlier rn) killfiles can apply regexps to arbitrary headers,
and have a optimize mode for just "overview" file headers, which load
faster than ordinary headers.

A quote from the manpage:
/pattern/modifiers:command{:command}

Apply the commands listed to articles matching the search
command (possibly with h, a, b, r, or K modifiers). The
default action, if no command is specified, is to select the
article's item in the selector (e.g. the entire thread ("++")
in the thread selector). See the section on Regular
Expressions and the description of pattern searching in the
Article Selection section.

One example: to scan all the unread articles looking for
"topic" anywhere in the article and then select its group and
save the articles to the files topic.1, topic.2, etc. use
"/topic/a:++:s topic.%#".

Modifiers include (header ones must be last):

Hheadername for overview file headers
hheadername for any header
a for anywhere in headers or body
b for article body searches with signature detection
B for article body searches including signatures

Commands include

j junk (mark read, with xref following)
x mark read, no xref usage
+ select article
++ select entire thread
s dest save to dest
| prog pipe to program

It doesn't have any facility for parsing date headers and operating on them,
but your < > operators could probably be used.
Post by J.B. Nicholson
If you know of such a thing, would you please point me in the
direction of the relevant published standard, documentation, or specs
for this syntax or functionality? I'd like to learn more about that
and avoid reinventing this wheel.
http://www.faqs.org/faqs/killfile-faq/

The FAQ is easier to understand than the manpage. Looking at examples of
mail filtering languages might be useful, too.

Elijah
------
procmail is very complicated but similarly powerful
J.B. Nicholson
2020-04-06 04:27:01 UTC
Permalink
Post by Eli the Bearded
Are those supposed only be independing actions, or are you envisioning
a statement system that includes ORs or ANDs?
That's a good question. I suppose that it would depend on how easy it
would be for users to use the ORs and ANDs. It's hard to say for sure
until I write something and try using it for a while.
Post by Eli the Bearded
trn (and earlier rn) killfiles can apply regexps to arbitrary headers,
and have a optimize mode for just "overview" file headers, which load
faster than ordinary headers.
[...]
http://www.faqs.org/faqs/killfile-faq/
The FAQ is easier to understand than the manpage. Looking at examples of
mail filtering languages might be useful, too.
Elijah
------
procmail is very complicated but similarly powerful
Thanks a lot for this valuable information, I appreciate the
references and opinions. I'll take a look at all of the items you've
listed.

Loading...