🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #190986

Re: [Pan] filter help

#190986
From: Peter J Ross
Date: Tue, 26 Sep 2006 12:34
82 lines
3672 bytes
On Mon, 25 Sep 2006 22:10:37 +1000, Mike Dee <mikedee@invalid.invalid>
wrote in news.software.readers:

> On Sat, 23 Sep 2006 15:55:19 +0100, Peter J Ross wrote:
>
>>>>     \bpan\b|slrn|(xnews)?.*(filte|\bkill|pcre|scor).*(?(1).*|\1)
>>>
> [...]
>>> "xnews is great at filtering out nuisances" works
>>> "filtering out nuisances with xnews, cool!" fails.
>> 
>> <gnashes teeth, tears hair>
>> 
>> My test expression produced a false positive that I misread as a true
>> positive.
>> 
>> It seems that there's nothing better than the /foo.*bar|bar.*foo/
>> syntax.
>
> You're darn toot'n! At least, myself, slrn, xnews and pan understand
> this method without loss of braincells, hair, or gnashing of teeth.

Slrn doesn't understand "|" (or \b, AFAIK).

http://www.s-lang.org/doc/html/slang-20.html

>> However, the following might also work and save keystrokes:
>> 
>>     \bpan\b|slrn|(xnews).*(filte|\bkill|pcre|scor)|(?2).*(?1)
>
> No no no, go back. The previous example was working in one direction.
> This one fails in both (in Xnews).
>
> That is, Xnews's built-in pcre checker tells me so - fails on
> unknown character after the "?" - doesn't elaborate on which "?"...
> Actual error msg: "Perlre: unrecognized character after (?"

This may be a problem with XNews's pcre implementation, since it works
in tin, and pcretest has no complaints:

#v+

pjr@etch:~$ pcretest
PCRE version 6.4 05-Sep-2005

re> /\bpan\b|slrn|(xnews).*(filte|\bkill|pcre|scor)|(?2).*(?1)/
data> xnews filters
 0: xnews filte
 1: xnews
 2: filte
data> filters xnews
 0: filters xnews
 1: <unset>
 2: <unset>
data> pan
 0: pan
data> slrn
 0: slrn
data> filter
 No match
data>

#v-

>> See "Subpatterns as subroutines" in man pcrepattern.
>
> Hmmm... I have tried to understand more complex
> methods of getting a seemingly simple task done but I'm coming to the
> conclusion '/foo.*bar|bar.*foo/' wins because of it's ease of use to
> implement and it's straight forward readability, especially in small or
> short scripts.

It's a matter of personal taste - unless only one method works.


PJR :-)
-- 
  _  _(o)_(o)_  _     | The fool hath said in his heart, "There is no Cabal."
._\`:_ F S M _:' \_,  | FSM: <http://www.venganza.org/>
    / (`---'\ `-.     | AUK: <http://www.netcabal.com/auk/>
 ,-`  _)    (_,   F_P | PJR: <http://insurgent.org/~pjr/>
Technical Details
Message-ID: <slrnehi7jk.d65.pjr@nntp.alcatroll.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!border2.nntp.dca.giganews.com!nntp.giganews.com!pd7cy3no!shaw.ca!news.alt.net!nntp.alcatroll.com!not-for-mail
References: <pan.2006.09.10.10.45.18.473064@Thank.You> <pan.2006.09.10.13.19.10.763936@emteedee.invalid> <pan.2006.09.14.10.52.03.166221@Thank.You> <Xns983F8C28A6185emteedeemotzarella@85.31.186.76> <slrnegnrpr.4jb.pjr@nntp.alcatroll.com> <Xns9841964BDE457emteedeemotzarella@85.31.186.76> <slrneh523g.4bq.pjr@nntp.alcatroll.com> <Xns9846B256E2D8Femteedeemotzarella@85.31.186.76> <slrnehainm.4jd.pjr@nntp.alcatroll.com> <pan.2006.09.25.12.10.30.800705@emteedee.invalid>

Show Full Headers
Complete Article Headers
Message-ID: <slrnehi7jk.d65.pjr@nntp.alcatroll.com>
Subject: Re: [Pan] filter help
Date: Tue, 26 Sep 2006 13:34:23 +0100
From: Peter J Ross <pjr@kookbusters.org>
References: <pan.2006.09.10.10.45.18.473064@Thank.You> <pan.2006.09.10.13.19.10.763936@emteedee.invalid> <pan.2006.09.14.10.52.03.166221@Thank.You> <Xns983F8C28A6185emteedeemotzarella@85.31.186.76> <slrnegnrpr.4jb.pjr@nntp.alcatroll.com> <Xns9841964BDE457emteedeemotzarella@85.31.186.76> <slrneh523g.4bq.pjr@nntp.alcatroll.com> <Xns9846B256E2D8Femteedeemotzarella@85.31.186.76> <slrnehainm.4jd.pjr@nntp.alcatroll.com> <pan.2006.09.25.12.10.30.800705@emteedee.invalid>
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!border2.nntp.dca.giganews.com!nntp.giganews.com!pd7cy3no!shaw.ca!news.alt.net!nntp.alcatroll.com!not-for-mail
Newsgroups: news.software.readers
Organization: Cabal Obsidian Order [TINCOO]
Lines: 82
X-Operating-System: Debian GNU/Linux (Ethc/Testing)
X-Kernel: Linux 2.6.17-2-686
User-Agent: slrn/0.9.8.1pl1 (Debian)