Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!sdd.hp.com!spool.mu.edu!uunet!mcsun!ukc!pyrltd!mwuk!tony From: tony@mwuk.UUCP (Tony Mountifield) Newsgroups: comp.editors Subject: Re: Using regular expressions in Micro Emacs 3.10 Message-ID: <427@mwuk.UUCP> Date: 17 May 91 09:11:22 GMT References: Distribution: comp Organization: Microware Systems (UK) Ltd., Winchester, UK. Lines: 44 In article badri@warren.mentorg.com (Badri Lokanathan) writes: -> 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 , 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 :-) You could always try replacing YY with Or define a macro which does: set $replace "" and then bind that macro to an unused key such as ^_ -> (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/ I don't think it is possible. You just have the ability to insert the WHOLE of the matched pattern using & -> -- -> Badri Lokanathan Go ahead, flame away. -> badri@sdl.scs.com (or) Make my day. -> ...!uunet!sdl!badri Tony. -- Tony Mountifield. | Microware Systems (UK) Ltd. MAIL: tony@mwuk.uucp | Leylands Farm, Nobs Crook, INET: tony%mwuk.uucp@ukc.ac.uk | Colden Common, WINCHESTER, SO21 1TH. UUCP: ...!mcsun!ukc!mwuk!tony | Tel: 0703 601990 Fax: 0703 601991 **** OS-9, OS-9000 Real Time Systems **** MS-DOS - just say "No!" ****