🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #216431

Re: [Leafnode] Filter for cigs?

#216431
From: Peter J Ross
Date: Tue, 05 Feb 2008 01:00
63 lines
2774 bytes
In news.software.readers on Tue, 05 Feb 2008 10:15:47 +1000, Troy
Piggins <usenet-0802@piggo.com> wrote:

> * andrew is quoted & my replies are inline below :
>> Hi,
>>
>> I am setting up a Leafnode-2 filter for the subject cigarettes as
>> follows:
>>
>> newsgroups = .*
>> pattern = ^Subject:.*[Cc]igarettes
>> action = kill
>>
>> but this primitive filter has a few shortcomings in that it does not
>> filter:
>>
>> 1. CIGARETTES
>> 2. cigarett
>> 3. cigarette
>>
>> All of which I have seen in various groups. Any thoughts?
>
> The pattern rule is a PCRE -> 'man pcre' and 'man pcrepattern' ;)
> Off the top of my head:
>
>      pattern = ^Subject:.*(?i)cigarette?s?
>
> (untested)

There's no point in checking for "e" and "s" if you're also going to
filter lines that contain neither "e" nor "s". Your pattern does the
sames as

	pattern = ^Subject:.*(?i)cigarett

but takes a few microseconds longer to do it.

#v+
pjr@desktop:~$ pcretest -t
PCRE version 7.4 2007-09-21

  re> /(?i)cigarett/
Compile time 0.0028 milliseconds
data> buy cigarettes online
Execute time 0.0005 milliseconds
 0: cigarett
data>
pjr@desktop:~$ pcretest -t
PCRE version 7.4 2007-09-21

  re> /(?i)cigarette?s?/
Compile time 0.0041 milliseconds
data> buy cigarettes online
Execute time 0.0009 milliseconds
 0: cigarettes
data>
pjr@desktop:~$
#v-

That's 0.000014 seconds wasted!

-- 
PJR :-)
Technical Details
Message-ID: <slrnfqfd9d.8jl.pjr@pjr.gotdns.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!news.albasani.net!news.motzarella.org!motzarella.org!not-for-mail
References: <20080205092408@ilium.andrews-corner.org> <20080205100839@usenet.piggo.com>

Show Full Headers
Complete Article Headers
Message-ID: <slrnfqfd9d.8jl.pjr@pjr.gotdns.org>
Subject: Re: [Leafnode] Filter for cigs?
Date: Tue, 05 Feb 2008 01:00:29 +0000
From: Peter J Ross <pjr@example.invalid>
References: <20080205092408@ilium.andrews-corner.org> <20080205100839@usenet.piggo.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!news.albasani.net!news.motzarella.org!motzarella.org!not-for-mail
Newsgroups: news.software.readers
Organization: none
Lines: 63
Reply-To: Peter J Ross <pjr.spam@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: feeder.motzarella.org
 U2FsdGVkX1/lHgjf8y+nP/NIzH34GDc3/HRzCRKIBjACKLOEEx1aDvJS+5wHF8e0BxsILs88KVLBQvg+mvc2BNqKTZu72lDEG2FbUP52sOMh0H4AEkHRSWHddAj3+lkuMqzZD/Bwxqs=
X-Complaints-To: Please send complaints to abuse@motzarella.org with full
 headers
NNTP-Posting-Date: Tue, 5 Feb 2008 01:00:44 +0000 (UTC)
X-Auth-Sender: U2FsdGVkX18igjKvBTCRBhnYSkePljim
Cancel-Lock: sha1:M6fTRBppZ/+RXmioLA2wVP+343s=
User-Agent: slrn/pre0.9.9-82 (Linux)