🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #50091

Re: docs on filter_art? Mime tools?

#50091
From: Andrew Gierth
Date: Wed, 24 Jan 2001 00:20
30 lines
2265 bytes
>>>>> "Russ" == Russ Allbery <rra@stanford.edu> writes:

 >> notes:
 >> - currently '\' is not special in a wildmat, most converters I've seen
 >> get this wrong. Likewise, '*' and '?' are not special inside [].

 Russ> I'm not sure quite what you meant here, but '\' is special
 Russ> outside of []; it always escapes the next character.

all this regexp hackery has obviously destroyed my brane; I have no idea
what I actually meant, and was probably confused.

Yes, \ outside [] is an escape. \ inside [] is a literal \ (at least in
deployed implementations. So a more correct version of the code would be
something like:

sub wildmat_to_regex
{
    my $w = quotemeta shift;
    $w =~ s{\\([*?]|\\(\\?.)|\[(?:\\\^)?(?:\\\])?[^]]*\\\])}
           {($1 eq '*' ? '.*' :
	     $1 eq '?' ? '.'  :
	     defined($2) ? $2 :
	     do { my $p = $1; $p =~ s/\\([][^-])/$1/g; $p; })}eg;
    return $w;
}

-- 
Andrew.
Technical Details
Message-ID: <87lms1hkci.fsf@erlenstar.demon.co.uk>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!supernews.google.com!sn-xit-02!sn-xit-01!supernews.com!feeder.qis.net!washdc3-snh1.gtei.net!cpk-news-hub1.bbnplanet.com!news.gtei.net!newspump.sol.net!news.execpc.com!newspeer.sol.net!news-feed.riddles.org.uk!erlenstar.demon.co.uk!newsmonster
References: <G7FGpD.6Fz@world.std.com> <yllms7cesh.fsf@windlord.stanford.edu> <G7Ko9B.M88@world.std.com> <yl7l3n3zy7.fsf@windlord.stanford.edu> <87n1cio3t8.fsf@erlenstar.demon.co.uk> <yl8zo1uaod.fsf@windlord.stanford.edu>

Show Full Headers
Complete Article Headers
Message-ID: <87lms1hkci.fsf@erlenstar.demon.co.uk>
Subject: Re: docs on filter_art? Mime tools?
Date: Wed, 24 Jan 2001 00:20:13 +0000
From: Andrew Gierth <andrew@erlenstar.demon.co.uk>
References: <G7FGpD.6Fz@world.std.com> <yllms7cesh.fsf@windlord.stanford.edu> <G7Ko9B.M88@world.std.com> <yl7l3n3zy7.fsf@windlord.stanford.edu> <87n1cio3t8.fsf@erlenstar.demon.co.uk> <yl8zo1uaod.fsf@windlord.stanford.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!supernews.google.com!sn-xit-02!sn-xit-01!supernews.com!feeder.qis.net!washdc3-snh1.gtei.net!cpk-news-hub1.bbnplanet.com!news.gtei.net!newspump.sol.net!news.execpc.com!newspeer.sol.net!news-feed.riddles.org.uk!erlenstar.demon.co.uk!newsmonster
Newsgroups: news.software.nntp
Organization: disorganised
Lines: 29
NNTP-Posting-Host: erlenstar.demon.co.uk (56a4:04bd)
X-Mayan-Date: Long count = 12.19.7.16.9; tzolkin = 8 Muluc; haab = 12 Muan
X-Pgp-0x0E9FFBE9: 87 25 7F 14 41 24 B3 51 E0 19 8B DE 49 74 0C 29
X-Attribution: AG
X-P-Persistent-Headers: are a bad idea.
X-Newsreader: Gnus v5.5/Emacs 20.2
X-Complaints-To: andrew@erlenstar.demon.co.uk
X-Post-Filter: postfilter v0.6 alpha