🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #80366

Re: Can Cleanfeed filter on a specific user?

#80366
From: Jeffrey M. Vinocur
Date: Wed, 11 Mar 2009 00:54
41 lines
2469 bytes
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';


-- 
Jeffrey M. Vinocur
jeff@litech.org
Technical Details
Message-ID: <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.dca.giganews.com!nntp.giganews.com!nlpi057.nbdc.sbc.com!prodigy.net!news.glorb.com!news2.glorb.com!news.litech.org!not-for-mail
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>

Show Full Headers
Complete Article Headers
Message-ID: <gp7244$ut5$1@puck.litech.org>
Subject: Re: Can Cleanfeed filter on a specific user?
Date: Wed, 11 Mar 2009 00:54:28 +0000
From: jeff@litech.org (Jeffrey M. Vinocur)
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>
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.dca.giganews.com!nntp.giganews.com!nlpi057.nbdc.sbc.com!prodigy.net!news.glorb.com!news2.glorb.com!news.litech.org!not-for-mail
Newsgroups: news.software.nntp
Organization: Litech Systems Design
Lines: 41
Sender: jeff@litech.org
NNTP-Posting-Host: puck.litech.org
X-Trace: puck.litech.org 1236732868 31653 66.218.0.75 (11 Mar 2009 00:54:28
 GMT)
X-Complaints-To: usenet@litech.org
NNTP-Posting-Date: Wed, 11 Mar 2009 00:54:28 +0000 (UTC)
X-Newsreader: trn 4.0-test76 (Apr 2, 2001)
Originator: jeff@litech.org (Jeffrey M. Vinocur)