Article View: comp.editors
Article #2662Using regular expressions in Micro Emacs 3.10
From: Badri Lokanathan
Date: Tue, 14 May 1991 15:03
Date: Tue, 14 May 1991 15:03
23 lines
1379 bytes
1379 bytes
I am running Micro Emacs 3.10 alpha on a Mac.
I encountered a couple of problems with the replace command:
(1) Suppose I need to do two global substitutions on a file:
- Insert XX at the beginning of each line
- delete YY at the end of each line
I set mode to MAGIC, then execute replace ^ with XX. Now when I try
to replace YY$ with <nothing>, I am unable to get rid of the former
replacement string XX.
Of course, I can always switch the order of execution, but that is not
the answer I am looking for :-)
(2) Is it possible to "remember" a matched pattern and interpolate it
into the replacement pattern (ala vi)? For those who are familiar with
vi, how does one achieve something like
s/\([a-z0-9]*\)_\([a-z0-9]*\)/\2_\1/
--
Badri Lokanathan Go ahead, flame away.
badri@sdl.scs.com (or) Make my day.
...!uunet!sdl!badri
Technical Details
Message-ID:
<BADRI.91May14150327@elysium.warren.mentor.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!sdl!elysium!badriShow Full Headers
Complete Article Headers
Newsgroups: comp.editors Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!sdl!elysium!badri From: badri@warren.mentorg.com (Badri Lokanathan) Subject: Using regular expressions in Micro Emacs 3.10 Message-ID: <BADRI.91May14150327@elysium.warren.mentor.com> Sender: badri@sdl.scs.com (Badri Lokanathan) Organization: Mentor Graphics IC group / Warren NJ 07059 Distribution: comp Date: 14 May 91 15:03:27