🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
8 messages
8 total messages Started by Dave Tue, 10 Jan 1995 01:26
kill files & regular expressions
#14455
Author: Dave
Date: Tue, 10 Jan 1995 01:26
15 lines
1129 bytes
I'm trying to filter my news a bit more thoroughly,
and would like to kill any article cross-posted
to more than three groups.

I've tried:

/^Newsgroups: *.*,*.*,*.*,*.*,/h:j

and it deletes everything with more than one group...including
the 'twos' and 'threes'.  I'm using rn on a Unix system...any
ideas or suggestions?

Thanks,

Dave
Re: kill files & regular expressions
#14464
Author: Peter Kappesser
Date: Tue, 10 Jan 1995 11:35
63 lines
3625 bytes
Recently in news.software.readers, dwomack@runner.utsa.edu (Dave) wrote:

>I'm trying to filter my news a bit more thoroughly, and would like to kill
>any article cross-posted to more than three groups. I've tried:
>
>/^Newsgroups: *.*,*.*,*.*,*.*,/h:j
>
>and it deletes everything with more than one group...including the 'twos'
>and 'threes'.  I'm using rn on a Unix system...any ideas or suggestions?

Argh, I remember the feeling when learning about regular expressions ... so
tough to get them to do what you want, if you don't already know! But once
you realize their sheer power and elegance, you feel as though whoever
invented them should get the Nobel Prize.

Anyway, what you want is:

/^Newsgroups: .*,.*,.*,/h:j

The * in a regular expression works differently than it does in file name
expansion: it means to match on zero or more occurrances of the -previous
character-. The . is a special character that matches on -any- character.
So, the combination .* means to match on any sequence of characters, which
is what you may have been meaning with *.* in your example. [Since a *
followed a , in your example, the ,s matched on zero or more occurrances --
except for the , at the end. Your command reduces to /^Newsgroups: .*,/
which is why it junked articles with any commas in the Newsgroups line --
i.e. crossposted to two or more groups.]

Purists would want to further refine the regexp to match only on the
characters legal in a newsgroup name, but this accomplishes the desired
result.

Another suggestion which would run more efficiently, but only if you switch
to trn, would be

/,.*,.*,/HNewsgroups:j

The H modifier in trn lets you specify which header line to look at so you
don't have to put it in the pattern (but it's limited to the headers trn
recognizes). Some sites could run almost lightning-quick, if configured to
take advantage of the extensions in the overview file format, with

/:.*:.*:/HXref:j

This way, trn doesn't have to fetch the rest of the header to examine it,
saving a little time (or a lot: the header has to be fetched for *each*
article in the newsgroup) -- the Xref info for each article may be found in
the overview file trn gets when it enters the newsgroup. The Xref line is of
the form

Xref: server.name news.group.one:123 news.group.two:456

so the number of colons you find there is the number of groups crossposted.
I use a similar trick to automagically select any FAQs, with

/news.answers/HXref:+

in my global killfile. But I have to remember to disable this when visiting
news.answers...

--
pjkappes@mailbox.syr.edu (Peter Kappesser)
Re: kill files & regular expressions
#14475
Author: stevebo
Date: Tue, 10 Jan 1995 18:16
20 lines
1490 bytes
>   pjkappes@forbin.syr.edu (Peter Kappesser) writes:
>  Recently in news.software.readers, dwomack@runner.utsa.edu (Dave) wrote:
>
>  >I'm trying to filter my news a bit more thoroughly, and would like to kill
>  >any article cross-posted to more than three groups. I've tried:
>  >
>  >/^Newsgroups: *.*,*.*,*.*,*.*,/h:j
>  Anyway, what you want is:
>
>  /^Newsgroups: .*,.*,.*,/h:j


Another way of doing this, since the dot itself matches ANY character is to use a construct like:

/^Newsgroups:[.].*[.].*[.].*/h:j

or whatever.  Enclosing the period within the brackets will allow you to look for the literal "."
Steve
------------------------------------
stevebo@onramp.net
Re: kill files & regular expressions
#14481
Author: Larry W. Virden
Date: Tue, 10 Jan 1995 18:42
24 lines
1725 bytes
> and would like to kill any article cross-posted
> to more than three groups.

and

> /^Newsgroups: *.*,*.*,*.*,*.*,/h:j

I think you really want:

/^Newsgroups: *..*,..*,..*,/h:j


This says 0 or more blanks, followed by
1 or more characters, followed by a comma, followed by
1 or more characters, followed by a comma, followed by
1 or more characters, followed by a comma, followed by
1 or more characters, followed by a comma


--
:s Larry W. Virden                 INET: larry.virden@cas.org
:s <URL:http://www-bprc.mps.ohio-state.edu/cgi-bin/hpp?lvirden_sig.html>
:s Unless explicitly stated to the contrary, nothing in this posting should
:s be construed as representing my employer's opinions.
Re: kill files & regular expressions
#14493
Author: Tim Pierce
Date: Tue, 10 Jan 1995 23:06
23 lines
1680 bytes
In article <3euitl$co9@news.onramp.net>,  <stevebo@onramp.net> wrote:

>   pjkappes@forbin.syr.edu (Peter Kappesser) writes:
>
>>  Anyway, what you want is:
>>
>>  /^Newsgroups: .*,.*,.*,/h:j
>
>Another way of doing this, since the dot itself matches ANY
>character is to use a construct like:
>
>/^Newsgroups:[.].*[.].*[.].*/h:j

(a) That's not an equivalent regular expression.
(b) A more concise method of matching only a period is to
    use the string "\." -- the backslash removes special
    meaning from metacharacters.
(c) You probably want to tell your editor to wrap lines at
    about 70 columns or thereabouts.

--
Green Card fodder: Canter, Siegel, green card, Joel Furr, liable,
fortune, conspiracy, CyberSell, Tennessee Bar.
Re: kill files & regular expressions
#14497
Author: Bill Marcum
Date: Wed, 11 Jan 1995 00:36
18 lines
1352 bytes
In article <3euitl$co9@news.onramp.net>,  <stevebo@onramp.net> wrote:
>
>Another  way of doing this, since the dot itself matches ANY character
>is to use a construct like:
>/^Newsgroups:[.].*[.].*[.].*/h:j
>
>or whatever.  Enclosing the  period within the brackets will allow you
>to look for the literal "." > Steve
>------------------------------------
>stevebo@onramp.net
>
That would also kill any articles in a newsgroup whose name contains
three or more dots.


--
Bill Marcum  bmarcum@iglou.com
filling the bathtub with brightly colored power tools
Re: kill files & regular expressions
#14588
Author: Paul Clark
Date: Sat, 14 Jan 1995 12:15
25 lines
1540 bytes
In article <3esnno$ndm@ringer.cs.utsa.edu> dwomack@runner.utsa.edu "Dave" writes:

> I'm trying to filter my news a bit more thoroughly,
> and would like to kill any article cross-posted
> to more than three groups.
> 
> I've tried:
> 
> /^Newsgroups: *.*,*.*,*.*,*.*,/h:j
> 
> and it deletes everything with more than one group...including
> the 'twos' and 'threes'.  I'm using rn on a Unix system...any
> ideas or suggestions?

Would 

/^Newsgroups: *,*,*,*/h:j

not do the trick?

Having said that, I'm not sure why yours matches anything, since you require
a comma at the end, so perhaps I'm missing something.  Do commas need
escaping?
-- 
Paul Clark <prc@sysmag.com>     "Technology depends on Ecology, not vice-versa"
Re: kill files & regular expressions
#14638
Author: Wayne Davison
Date: Mon, 16 Jan 1995 21:57
23 lines
1494 bytes
According to Paul Clark <prc@sysmag.com>:
> /^Newsgroups: *,*,*,*/h:j
> not do the trick?

No, '*'s in searches are not evaluated as wildcards (except when scanning
for a newsgroup name) and they are never anchored unless you explicitly
ask them to be.  Your regex above matches (after the ':') any number of
spaces (including zero) and then (redundantly) any number of consecutive
commas (including zero) and then any other text (so it matches all
Newsgroups lines).

> Having said that, I'm not sure why yours matches anything, since you require
> a comma at the end

No, requiring a comma to be at the end would look like this:

	/^newsgroups:.*,$/h:j
or	/,$/Hnewsgroups:j

(note the end-of-string anchor, '$').
-- 
Wayne Davison
davison@borland.com
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads