🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #217490

Re: [Leafnode] Filter for cigs?

#217490
From: Marshall Price
Date: Thu, 06 Mar 2008 18:15
83 lines
3431 bytes
Peter J Ross wrote:
> 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!
> 

I don't get it.  Comparing execute times: 0.0009 milliseconds - 0.0005 
milliseconds equals 0.0004 milliseconds (or 0.0000004 seconds, or 400 
nanoseconds).

Granted, it's the principle that counts, and light can travel pretty far 
in that amount of time, but how about the time spent studying the pcre 
manual?

You could get to Barnard's Star and back in that amount of time, and 
though you'd be younger than your contemporaries the next time they saw 
you, they'd probably tell you nobody uses a keyboard anymore, not to 
mention perl!

And they'd tell you by mental telepathy, so grammar, spelling, and 
regular expressions wouldn't matter anymore either.

<virtual name="smiley" content="wink" />

-- 
Marshall Price of Miami
Known to Yahoo as d021317c
Technical Details
Message-ID: <13t0d6s8de9b0f8@corp.supernews.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!postnews.google.com!news1.google.com!news.glorb.com!sn-xt-sjc-05!sn-xt-sjc-09!sn-post-sjc-01!supernews.com!corp.supernews.com!not-for-mail
References: <20080205092408@ilium.andrews-corner.org> <20080205100839@usenet.piggo.com> <slrnfqfd9d.8jl.pjr@pjr.gotdns.org>

Show Full Headers
Complete Article Headers
Message-ID: <13t0d6s8de9b0f8@corp.supernews.com>
Subject: Re: [Leafnode] Filter for cigs?
Date: Thu, 06 Mar 2008 13:15:52 -0500
From: Marshall Price <d021317c@yahoo.com>
References: <20080205092408@ilium.andrews-corner.org> <20080205100839@usenet.piggo.com> <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!postnews.google.com!news1.google.com!news.glorb.com!sn-xt-sjc-05!sn-xt-sjc-09!sn-post-sjc-01!supernews.com!corp.supernews.com!not-for-mail
Newsgroups: news.software.readers
Organization: Posted via Supernews, http://www.supernews.com
User-Agent: Thunderbird 2.0.0.12 (Windows/20080213)
MIME-Version: 1.0
In-Reply-To: <slrnfqfd9d.8jl.pjr@pjr.gotdns.org>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Complaints-To: abuse@supernews.com
Lines: 83