Article View: news.software.nntp
Article #80365Re: Can Cleanfeed filter on a specific user?
From: John F. Morse
Date: Wed, 11 Mar 2009 01:25
Date: Wed, 11 Mar 2009 01:25
76 lines
4053 bytes
4053 bytes
Jeffrey M. Vinocur wrote:
> In article <gp4jp2$tc5$1@optima7.xanadu-bbs.net>,
> John F. Morse <dont.bother> wrote:
>
>> Can your my $badpeople = 'aol\.com'; be added to in the future with the
>> alternation metacharacter '|' ? Such as:
>>
>> my $badpeople = 'aol\.com'|'gmail\.com'|'microsoft\.com'|'ex-wife';
>>
>> and so forth?
>>
>
> Eek not quite like that.
>
> The single quotes define a string. The equals sign puts that
> string into a variable. When you use the variable in a regular
> expression (or almost anywhere else), the contents of that string
> are inserted in place of the variable.
>
> So you can't do
>
> my $badpeople = 'aol\.com'|'gmail\.com'|'microsoft\.com'|'ex-wife';
>
> any more than you can do
>
> print 'aol\.com'|'gmail\.com'|'microsoft\.com'|'ex-wife';
>
> because there's nothing magical about combining strings with | to
> make some extra special kinda of string that you're then putting
> into a variable. (The | used as top-level syntax like you're
> doing means something totally different.)
>
> But you -can- absolutely do what you're intending, by making one
> long string that goes into a variable, and then putting that into
> the regular expression. (It's the regular expression that makes
> the | mean what you think it means.) Like this:
>
> my $badpeople = 'aol\.com|gmail\.com|microsoft\.com|ex-wife';
>
Understood.
This is similar to what Steve recommended for multiple bad guys:
if ($hdr{'From'} =~ /
steve\@mixmin\.net # Troll
| example\@invalid\.org # Flooder
| \@baddomain.com # Shoe sales
/x) {
I did try the above, but perl -wc reports a syntax error that I couldn't
find/fix. Maybe it was a missing curly bracket?
I'll find it because I'm going to fire up an off-line INN and play with
this so I won't be disturbing the "public." ;-)
I did spend several hours last night reading the Perl documentation, but
without trial and error practice, it will quickly slip away.
Memory that is 64 years old doesn't retain like it did 30 years ago,
when I could read a book on assembler, Pascal, FORTRAN, ..., and
practically memorize it.
Enjoy while you can. ;-)
And thanks for your help, Jeff. It is appreciated.
--
John
No Microsoft, Apple, AT&T, Novell, Trend Micro, nor Ford products were used in the preparation or transmission of this message.
The EULA sounds like it was written by a team of lawyers who want to tell me what I can't do. The GPL sounds like it was written by a human being, who wants me to know what I can do.
Technical Details
Message-ID:
<gp73uj$ic1$1@optima7.xanadu-bbs.net>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!news.astraweb.com!border5.newsrouter.astraweb.com!feeder6.cambrium.nl!feed.tweaknews.nl!feeder.news-service.com!nntp.club.cc.cmu.edu!74.222.216.191.MISMATCH!optima7.xanadu-bbs.net!not-for-mailReferences:
<gou9pu$a8c$1@optima7.xanadu-bbs.net> <gp3fbd$k29$1@optima7.xanadu-bbs.net> <gp4hp7$u1j$1@puck.litech.org> <gp4jp2$tc5$1@optima7.xanadu-bbs.net> <gp7244$ut5$1@puck.litech.org>Show Full Headers
Complete Article Headers
Message-ID: <gp73uj$ic1$1@optima7.xanadu-bbs.net> Subject: Re: Can Cleanfeed filter on a specific user? Date: Tue, 10 Mar 2009 20:25:39 -0500 From: "John F. Morse" <xanadu.bbs@example.invalid> References: <gou9pu$a8c$1@optima7.xanadu-bbs.net> <gp3fbd$k29$1@optima7.xanadu-bbs.net> <gp4hp7$u1j$1@puck.litech.org> <gp4jp2$tc5$1@optima7.xanadu-bbs.net> <gp7244$ut5$1@puck.litech.org> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!news.astraweb.com!border5.newsrouter.astraweb.com!feeder6.cambrium.nl!feed.tweaknews.nl!feeder.news-service.com!nntp.club.cc.cmu.edu!74.222.216.191.MISMATCH!optima7.xanadu-bbs.net!not-for-mail Newsgroups: news.software.nntp Organization: Xanadu BBS Lines: 76 Reply-To: dont.bother NNTP-Posting-Host: n100.xanadu-bbs.net Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: optima7.xanadu-bbs.net 1236734739 18817 192.168.89.210 (11 Mar 2009 X-Complaints-To: newsmaster@xanadu-bbs.net NNTP-Posting-Date: Wed, 11 Mar 2009 01:25:39 +0000 (UTC) User-Agent: Thunderbird 2.0.0.19 (X11/20090105) In-Reply-To: <gp7244$ut5$1@puck.litech.org> X-Original-Bytes: 3792