Article View: news.software.readers
Article #166514[slrn] Macro to delete block of text
From: Ian Petts
Date: Mon, 09 May 2005 23:23
Date: Mon, 09 May 2005 23:23
38 lines
2019 bytes
2019 bytes
I've been using slrn for a couple of months now and think it's great. I've
just started playing around with S-lang macros and am stuck on something I
thought would have been quite easy.
I'd like to be able to delete a block of text in the article body, defined by a
regular expression or the beginning/end of the article.
For example, given the text:
line 1
line 2
line 3
---
after1
after2
after3+end
I want to be able to delete from, say, '---' to the end of the article, but
have had little success. In particular, I can't seem to match from my
expression to the end of the text. Here is the code I have been using as a
test:
variable div = "---";
variable article="line 1\nline 2\nline 3\n---\nafter1\nafter2\nafter3+end";
if (string_match(article, div, 1)) {
(article,) = strreplace(article, div, "", strlen(article));
printf("%s\n", article);
}
This removes the divider just fine, but how can I include the rest of the text?
Adding a "\n.*" RE to the search string doesn't help.
Is there already a macro somewhere that does this? If not, can someone give me
some pointers?
Thanks,
Ian.
Technical Details
Message-ID:
<slrnd7vtch.bai.ipetts@lexx.pettsie.net>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.ams.giganews.com!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news1.optus.net.au!optus!news.mel.connect.com.au!news-south.connect.com.au!duster.adelaide.on.net!not-for-mailShow Full Headers
Complete Article Headers
Message-ID: <slrnd7vtch.bai.ipetts@lexx.pettsie.net> Subject: [slrn] Macro to delete block of text Date: Mon, 09 May 2005 23:23:13 +0000 From: Ian Petts <ipetts@gmail.com_no_spam_thanks> 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.ams.giganews.com!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news1.optus.net.au!optus!news.mel.connect.com.au!news-south.connect.com.au!duster.adelaide.on.net!not-for-mail Newsgroups: news.software.readers User-Agent: slrn/0.9.8.1 (Debian) NNTP-Posting-Host: ppp58-146.lns1.cbr1.internode.on.net X-Trace: duster.adelaide.on.net 1115682193 59.167.58.146 (10 May 2005 09:13:13 +0950) Lines: 38