View Single Post
  #10   Report Post  
Posted to rec.crafts.metalworking
Joe gwinn Joe gwinn is offline
external usenet poster
 
Posts: 416
Default Need regex code for counting newsgroups

In article , DoN.
Nichols wrote:

On 2013-08-17, Joe Gwinn wrote:
There was a thread some time ago on ways to kill postings with too many
cross-posts. Some of these methods involved regular expressions, most
likely counting commas in the newsgroups header. Can anyone provide a
pointer to the thread, or related threads?


The way I do it is based on the commas in the "Newgsgroups: "
header.

Two newgroups .*,.*
Three newsgroups .*,.*,.*
Four newsgroups .*,.*,.*,.*

Whe ".*" means any number of any characters.
',' means itself -- a plain old comma.


That's what I was trying to remember. I knew there was a simple,
battle-tested solution. Thanks


Exactly how you tell your newsreader to use those varies.


I use Thoth, which uses the Perl regex engine PCRE
http://www.pcre.org/.


I would do something like "-10" for each one of those, so two newsgroups
would be -10, three would be -20, four (or more) would be -30, and set
the auto-kill threshold to -15. (Three is too many in cross-posting.)


Wonder if there is a direct way to count commas and kill if count
exceeds some threshold.


I also use + scores on the "Subject: " header for the very few things
which I want to see which are cross-posted, such as the "What Is It"
weekly puzzle posting thread.


I can also put the subject header test earlier in the processing, and
terminate filter processing for the correct subject.


Joe Gwinn