🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #147380

Re: [slrn] RegEx matching a Message-ID

#147380
From: J.B. Nicholson-Owens
Date: Sat, 01 May 2004 00:28
29 lines
2403 bytes
Dirk Nimmich wrote:
> Tin uses
> 
>    \b(?:s?news|nntp):[^\s@]+[@.][^\s@]+(?:$|(?=[\s.><,\"/():]))\b

If you can't wait for PCRE to be used in S-Lang, try the following:

  if (andelse
        { orelse { string_match (m, "^nntp:", 1) } { string_match (m, "^s?news:", 1) } }
	{ string_match (m, ":[^@]+@", 1) }
	{ string_match (m, "@[-a-zA-Z0-9.]+",1 ) })
     { ... it matched ... }

where 'm' is a word that might be a message-ID.

The above code snippet is not the same as above the PCRE expression; coding
all the fancy things one can do with a modern regular expression engine in a
snippet brief enough to share here is not trivial.  Regular expressions are
a far better method of doing this job. But this might give you a good
starting place or some inspiration to get something good enough for testing
or playing with.

In the future if PCRE became the regular expression engine of the next major
S-Lang, you should be able to use the same expression tin uses or a better
one.  If you wish, you can check out
ftp://space.mit.edu/pub/davis/misc/modules-1.4.8.tar.gz which has a PCRE
module.  Please do tell people if your macros require a specific module so
they can load that module into their S-Lang-based program before
interpreting your macro.
Technical Details
Message-ID: <slrnc95rq4.5gt.jbn@forestfield.org>
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.sjc.giganews.com!border2.nntp.sjc.giganews.com!border1.nntp.sjc.giganews.com!nntp.giganews.com!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.arcor.de!newsfeed.arcor-online.net!fu-berlin.de!uni-berlin.de!12-221-67-248.client.insightbb.COM!not-for-mail
References: <slrnc95dh6.12s.lars@stokholm.dyndns.dk> <c6udi4$71u$06$1@news.t-online.com>

Show Full Headers
Complete Article Headers
Message-ID: <slrnc95rq4.5gt.jbn@forestfield.org>
Subject: Re: [slrn] RegEx matching a Message-ID
Date: Sat, 01 May 2004 00:28:53 +0000
From: "J.B. Nicholson-Owens" <jbn@forestfield.org>
References: <slrnc95dh6.12s.lars@stokholm.dyndns.dk> <c6udi4$71u$06$1@news.t-online.com>
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.sjc.giganews.com!border2.nntp.sjc.giganews.com!border1.nntp.sjc.giganews.com!nntp.giganews.com!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.arcor.de!newsfeed.arcor-online.net!fu-berlin.de!uni-berlin.de!12-221-67-248.client.insightbb.COM!not-for-mail
Newsgroups: news.software.readers
Organization: Forest Field OmniMedia
Lines: 29
NNTP-Posting-Host: 12-221-67-248.client.insightbb.com (12.221.67.248)
X-Trace: news.uni-berlin.de 1083371333 17349350 I 12.221.67.248 ([35848])
Mail-Copies-To: nobody
User-Agent: slrn/0.9.7.4 (Linux)