🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #146750

Re: [Xnews] Best way to send GnuPG signed messages with Xnews?

#146750
From: Murray Peterson
Date: Tue, 20 Apr 2004 05:21
43 lines
2656 bytes
"Guy" <Use-Author-Supplied-Address-Header@[127.1]> wrote in
news:314421082436180-519993551ab4@127.0.0.1: 

> The below will strip PGP signatures in a reply:
> SigDashRegex=^\-\-\s?$|^(\-{5}\s?)BEGIN\b\s\PGP\b\s\SIGNATURE\b\1$|^\-\
> s\-\-\s?$|^\-\-\-$ 
> 
> Perhaps someone could make it more efficient?
>  hint Murray ;)

> -----BEGIN PGP SIGNATURE-----

I am not sure what variations these signatures are allowed, but if they 
match yours, then you can simplify the regexp a lot.  Several things to 
note:

1. "-" is not a special character, so no need to escape it
2. If matching 5 or more dashes, then no need to remember the sub-
expression unless this is an important feature of recognizing a PGP sig.
3. Matching is case insensitive be default
4. No need to use the word boundary anchors
5. Are any spaces allowed between the dashes and the words?
6. Is only a single space allowed between the words?
7. Probably no need to anchor the end of the sig to end of line

Assuming that the answer to #5 is "no", and to #6 is "yes", then here is a 
simple one (PGP part only):

    	^-{5}begin pgp signature-{5}

If we allow extra spaces in a few places, then you can use this:

    	^-{5}\s*begin\s+pgp\s+signature\s*-{5}

If exactly 5 dashes are required (no more, no less), then you can leave 
out the repeat counters:

    	^-----begin pgp signature-----

-- 
Murray Peterson
Email: murray_peterson@shaw.ca (remove underscore)
URL:   http://members.shaw.ca/murraypeterson/
Technical Details
Message-ID: <Xns94D0EDF64458Afarkle@24.71.223.159>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!number1.nntp.ash.giganews.com!internal1.nntp.ash.giganews.com!border2.nntp.ash.giganews.com!border1.nntp.ash.giganews.com!nntp.giganews.com!pd7cy2so!shaw.ca!pd7tw1no.POSTED!53ab2750!not-for-mail
References: <Xns94CFA40DF6B3Fsimeramov@161.53.2.66> <253971082303882-387305551ab4@127.0.0.1> <Xns94D08A5A971Csimeramov@161.53.2.66> <314421082436180-519993551ab4@127.0.0.1>

Show Full Headers
Complete Article Headers
Message-ID: <Xns94D0EDF64458Afarkle@24.71.223.159>
Subject: Re: [Xnews] Best way to send GnuPG signed messages with Xnews?
Date: Tue, 20 Apr 2004 05:21:09 GMT
From: Murray Peterson <mwp@home.com.invalid>
References: <Xns94CFA40DF6B3Fsimeramov@161.53.2.66> <253971082303882-387305551ab4@127.0.0.1> <Xns94D08A5A971Csimeramov@161.53.2.66> <314421082436180-519993551ab4@127.0.0.1>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!number1.nntp.ash.giganews.com!internal1.nntp.ash.giganews.com!border2.nntp.ash.giganews.com!border1.nntp.ash.giganews.com!nntp.giganews.com!pd7cy2so!shaw.ca!pd7tw1no.POSTED!53ab2750!not-for-mail
X-Trace-PostClient-IP: 68.145.154.18
Newsgroups: news.software.readers
Organization: None
User-Agent: Xnews/06.02.16
Lines: 43
NNTP-Posting-Host: 24.71.223.147
X-Complaints-To: abuse@shaw.ca
X-Trace: pd7tw1no 1082438469 24.71.223.147 (Mon, 19 Apr 2004 23:21:09 MDT)
NNTP-Posting-Date: Mon, 19 Apr 2004 23:21:09 MDT