Article View: news.software.readers
Article #217531Re: [Leafnode] Filter for cigs?
From: Peter J Ross
Date: Sat, 08 Mar 2008 19:18
Date: Sat, 08 Mar 2008 19:18
108 lines
4498 bytes
4498 bytes
In news.software.readers on Thu, 06 Mar 2008 13:15:52 -0500, Marshall Price <d021317c@yahoo.com> wrote: > 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). You're not including the difference in compile times. You may be right not to do so, since execution happens far more frequently than compilation. > 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? Fun is never a waste of time! Learning PCRE is the same kind of fun as learning a foreign language. > You could get to Barnard's Star and back in that amount of time, I find the trip gets boring after a while, since the scenery never changes much. > 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! What's a keyboard? I use telekinesis for everything nowadays (though filling a fountain pen can be messy if I'm distracted). > And they'd tell you by mental telepathy, so grammar, spelling, and > regular expressions wouldn't matter anymore either. I still find regexes useful to keep my extensive telepathic killfile organised. > <virtual name="smiley" content="wink" /> /me sends appropriate facial expression -- PJR :-) <http://pjr.lasnobberia.net/usenet/>
Technical Details
Message-ID:
<slrnft5pjp.c76.pjr@pjr.motzarella.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.mbox.zip!g2news1.google.com!news2.google.com!news.glorb.com!tudelft.nl!txtfeed1.tudelft.nl!feeder.news-service.com!news.motzarella.org!motzarella.org!not-for-mailReferences:
<20080205092408@ilium.andrews-corner.org> <20080205100839@usenet.piggo.com> <slrnfqfd9d.8jl.pjr@pjr.gotdns.org> <13t0d6s8de9b0f8@corp.supernews.com>Show Full Headers
Complete Article Headers
Message-ID: <slrnft5pjp.c76.pjr@pjr.motzarella.org> Subject: Re: [Leafnode] Filter for cigs? Date: Sat, 08 Mar 2008 19:18:17 +0000 From: Peter J Ross <pjr@example.invalid> References: <20080205092408@ilium.andrews-corner.org> <20080205100839@usenet.piggo.com> <slrnfqfd9d.8jl.pjr@pjr.gotdns.org> <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.mbox.zip!g2news1.google.com!news2.google.com!news.glorb.com!tudelft.nl!txtfeed1.tudelft.nl!feeder.news-service.com!news.motzarella.org!motzarella.org!not-for-mail Newsgroups: news.software.readers Organization: none Lines: 107 Reply-To: Peter J Ross <peadar.ruadh@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: feeder.motzarella.org U2FsdGVkX1+uh7POI+1LFgtw3MQwr13mHPrhqV1qOtoaC/towyuMBggmPJ740E/rJXNhitFWbJBjo5zbzFj/aaMJIl1WydpCOut77g0w+PmsEMgl5FzhNUmvndhMCVXRSpc6jf7kRlA= X-Complaints-To: Please send complaints to abuse@motzarella.org with full headers NNTP-Posting-Date: Sat, 8 Mar 2008 19:21:03 +0000 (UTC) X-Auth-Sender: U2FsdGVkX1/U9xV/Y51rLAd37iysnW8J Cancel-Lock: sha1:n0WFSLF+W1uUaR28Tg6Pb8Jz3f8= User-Agent: slrn/pre0.9.9-97/mm (Linux)