🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc
Article #15722

Re: PD text editor w/ regular expression string search?

#15722
From: boykin
Date: Thu, 12 Feb 1987 17:36
26 lines
1669 bytes
> Lawrence's microEmacs v3.8 has some regular-expression capability.  I don't
> know how to search for a pattern _and_then_replace_part_of_it_ (without
> trashing the entire pattern), but this may reflect my lack of skills with
> regular expressions.  (I can't manage this in vi, either.)

This is off of the original topic, but probably worth answering anyway...

To replace part of a regular expression from within VI you must
use parethesized regular expressions.  For example.  If you
want to search for "foo bar", but only want to replace "bar" with
"BAR", you can do the following:

	:sub/\(foo \)\(bar\)/\1BAR/

You can also do:

	:sub/\(foo \)\(bar\)/\1\U\2/

Note that \1 and \2 in the substitution portion provides the text which
matched the the Nth subexpression.  \U turns on conversion to upper-case.
Unfortunately, there aren't many VI manuals which talk about all you
can do with regular expressions (of course PC/VI's does! :-) )

Joe Boykin
Custom Software Systems
{necntc, frog}!custom!boykin
Technical Details
Message-ID: <504@custom.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!clyde!cuae2!ihnp4!ptsfa!lll-lcc!seismo!columbia!rutgers!mit-eddie!bu-cs!halleys!frog!custom!boykin
References: <1041@uwmacc.UUCP> <2709@iuvax.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!utgpu!water!watnot!watmath!clyde!cuae2!ihnp4!ptsfa!lll-lcc!seismo!columbia!rutgers!mit-eddie!bu-cs!halleys!frog!custom!boykin
From: boykin@custom.UUCP
Newsgroups: comp.sys.ibm.pc
Subject: Re: PD text editor w/ regular expression string search?
Message-ID: <504@custom.UUCP>
Date: Thu, 12-Feb-87 12:36:00 EST
Article-I.D.: custom.504
Posted: Thu Feb 12 12:36:00 1987
Date-Received: Sat, 14-Feb-87 13:39:17 EST
References: <1041@uwmacc.UUCP> <2709@iuvax.UUCP>
Organization: Custom Software Systems; Natick, MA
Lines: 25
Summary: VI regular expressions