🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.emacs
Article #2185

Re: regular expressions and operations

#2185
From: prestat
Date: Thu, 23 Oct 1986 15:24
30 lines
1724 bytes
All the responses to the question about using regular
expressions to select lines seem to be non-responsive.
While phr gave a useful summary from the manual that
points out that there IS a command to do the particular
example the questioner used, that was just an example,
not the whole question.

There ought to be a function to map another function
over the lines of the file, preferably with an re
filter.  On the other hand, it really wouldn't be hard to
write one.  You just need a function that takes a
string (the regular expression) and a function (to be
applied to matching lines) and loops over the buffer
looking for matching lines and applying the function.
I haven't memorized GNU function names, so I won't try
to write the function here.

You could also have a map-over-re-strings function that
stepped through the matching REs in the buffer and applied
the function to each.

For non-GNU users, you can delete matching lines in Unipress
by using hard newlines.  That is, turn
newline.*pattern.*newline into newline.  You can get a
newline in your patterns by quoting control-j.

--
scott preece
PREECE@GSWD-VMS.ARPA
Technical Details
Message-ID: <4300002@uicsl>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbatt!ihnp4!inuxc!pur-ee!uiucdcs!uiucuxc!uicsl!prestat
References: <1168@peregrine.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbatt!ihnp4!inuxc!pur-ee!uiucdcs!uiucuxc!uicsl!prestat
From: prestat@uicsl.UUCP
Newsgroups: net.emacs
Subject: Re: regular expressions and operations
Message-ID: <4300002@uicsl>
Date: Thu, 23-Oct-86 10:24:00 EST
Article-I.D.: uicsl.4300002
Posted: Thu Oct 23 10:24:00 1986
Date-Received: Sun, 26-Oct-86 01:12:39 EST
References: <1168@peregrine.UUCP>
Lines: 30
Nf-ID: #R:peregrine.UUCP:1168:uicsl:4300002:000:1132
Nf-From: uicsl.UUCP!prestat    Oct 23 09:24:00 1986