Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!microsoft!steveha From: steveha@microsoft.UUCP (Steve Hastings) Newsgroups: comp.editors Subject: Re: ex search & substitution question Message-ID: <56403@microsoft.UUCP> Date: 8 Aug 90 16:25:35 GMT References: <3440001@hprnd.HP.COM> <26814@nigel.ee.udel.edu> <1990Aug07.174235.28911@hoss.unl.edu> Reply-To: steveha@microsoft.UUCP (Steve Hastings) Organization: Microsoft International Products Group Lines: 21 In article <1990Aug07.174235.28911@hoss.unl.edu> sanjiv@hoss.unl.edu (Sanjiv K. Bhatia) writes: >In article <26814@nigel.ee.udel.edu> new@ee.udel.edu (Darren New) writes: >>Try >>:10,20g/^#[iut]55/s/55/71/ >> > >Here is my $0.02 worth. I prefer to use the substitute command 's'. > >:10,20s/^#[iut]55/77/ This will replace everything with "77". Try this: :10,20s/^\(#[iut]\)55/\177/ ^^ ^^ ^^ The \( \) quotes part of the match pattern, and the \1 evaluates to the quoted pattern. You can have up to 9 pairs of \( \), referred to as \1 to \9 in the replacement part. But for this example, I think the g// is better. -- Steve "I don't speak for Microsoft" Hastings ===^=== ::::: uunet!microsoft!steveha steveha@microsoft.uucp ` \\==|