[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [leafnode-list] Filtering revisited.



Mark Harrison wrote:

> tmcd@xxxxxxxx <tmcd@xxxxxxxx> wrote:
> >I advocate only having one syntax:
> >    Newsgroups: [some arbitrary regex]
> >    Regex: [some arbitrary regex]
> >Less code, less to learn, regexen are more powerful, et cetera.
> 
> The only problem I see with regex for newsgroups is that
> they are more error prone and not quite as direct
> (especially due to quoting periods):
> 
> with glob:
>     Newsgroups:  comp.mail.*
>     Newsgroups:  comp.lang.*.announce
> 
> with regex:
>     Newsgroups:  comp\.mail\..*
>     Newsgroups:  comp\.lang\.[^.]+\.announce$

I agree with Mark that I think regex stuff is too complicated for newsgroups.
In addition, you probably don't need regex selection power for newsgroup
names, globs will suffice. Code-wise it will not make much difference since
some parts of leafnode already use globs.

> Cornelius, have you thought about integrating something
> like Tcl to handle the parsing?

I have no clue about tcl whatsoever, but the syntax I've proposed is not
very difficult to parse. In essence, you can probably use the parser from
the configutil.c and rewrite it a little bit (use : instead of = as the
"magic sign"), or, even better, use it without any change and rewrite
the syntax, i.e.

Newsgroups: comp.mail.*
Regex: ^Subject:.*\$\$\$
Action: kill

would become

Newsgroups = comp.mail.*
Regex = ^Subject:.*\$\$\$
Action = kill

When writing this example, I realized that it would probably be a good idea
to have an additional switch deciding whether regex should be case-sensitive
or not.  The regex example I wanted to use originally was "Make Money Fast"
which could also be written "MAKE MONEY FAST"; to encode different writings
in regex, you would have to write
"[Mm][Aa][Kk][Ee] [Mm][Oo][Nn][Ee][Yy] [Ff][Aa][Ss][Tt]" which is
rather a pain, especially on a Mac with a German keyboard (where it is
quite difficult to reach brackets).

Cheers,
--Cornelius.

-- 
/* Cornelius Krasel, U Wuerzburg, Dept. of Pharmacology, Versbacher Str. 9 */
/* D-97078 Wuerzburg, Germany   email: phak004@xxxxxxxxxxxxxxxxxxxxxx  SP4 */
/* "Science is the game we play with God to find out what His rules are."  */

-- 
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list