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

[leafnode-list] Advanced filtering: Unfold headers?



Hi,

my impression is (please CMIIW) that leafnode's (2.0.0.alpha*)
filtering doesn't unfold headers.  

Simple example:

,----[ filters ]
| newsgroups = gmane.test
| pattern = ^Subject:\s*leafnode filter
| action = -1
| pattern = ^References:.*7g7k6bzkqm.fsf@xxxxxxxxxxxxxxxx
| action = select
`----

,----[ /var/spool/news/gmane/test/262 ]
| Subject: leafnode filterfile (was: =?iso-8859-1?q?Pr=F8ve=29?=
| Date: Tue, 22 Jul 2003 18:06:51 +0200
| Message-ID: <v965luzgtg.fsf_-_@xxxxxxxxxxxxxxxxxxxxxxxxxx>
| References: <7gfzl017bn.fsf@xxxxxxxxxxxxxxxx> <7g7k6c12x0.fsf@xxxxxxxxxxxxxxxx>
|  <7g3ch010gz.fsf@xxxxxxxxxxxxxxxx> <7gy8yrzujs.fsf@xxxxxxxxxxxxxxxx>
|  <7gu19fzocb.fsf@xxxxxxxxxxxxxxxx> <7gptk3zmw6.fsf@xxxxxxxxxxxxxxxx>
|  <7gk7abzm18.fsf@xxxxxxxxxxxxxxxx> <7g7k6bzkqm.fsf@xxxxxxxxxxxxxxxx>
`----

,----[ applyfilter -v -n gmane.test ]
| 262 would be deleted
`----

Is it somehow possible to unfold headers for filtering?  Or can I use
a pcre that includes line endings?

*time passes*

Reading pcre(3), it seems that PCRE_MULTILINE could be helpful (and
fortunately filterutil.c uses it).

| pattern = ^References:\s*(.|\n)*7g7k6bzkqm.fsf@xxxxxxxxxxxxxxxx
                           ^^^^^^

This seems to do the trick.  But using "\s*(.|\n)*" looks strange.  Is
this the right thing to do or is there a better way? 

PCRE_MULTILINE [1] requires that "\n", "^" _or_ "$" appears in the
pattern.  So what's wrong with the following expression?

| pattern = ^References:.*7g7k6bzkqm.fsf@xxxxxxxxxxxxxxxx

| pattern = ^References:.*7g7k6bzkqm.fsf@xxxxxxxxxxxxxxxxx*$

Bye, Reiner.

P.S.: I know that I should better use "\." instead of ".".

[1]
,----[ pcre(3) ]
| 	When PCRE_MULTILINE it is set,  the "start of line" and "end
| 	of   line"  constructs   match   immediately  following   or
| 	immediately  before  any  newline  in  the  subject  string,
| 	respectively, as well as at  the very start and end. This is
| 	equivalent  to  Perl's  /m  option.  If there  are  no  "\n"
| 	characters in a subject string,  or no occurrences of ^ or $
| 	in a pattern, setting PCRE_MULTILINE has no effect.
`----
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo--- PGP key available via WWW   http://rsteib.home.pages.de/

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