I have a program with a number of constructs like this:-

 for subscriptI to count someThing do
   something( subscriptI )  := ""
 repeat
@...
 begin
   for subscriptJ to count someThingElse do
     someThingElse( subscriptJ )  := ""
   repeat
 end

And I ant to replace all the different subscripts with a generic 'i' or (for 
nested loops) 'j'

What I thought of was to use a global operation limited to the 'for' and the 
matching 'repeat', and what I tried was this:-

:/^\(\s\+\)for\s\+\(\a\k*\)\s\+to.*/,/^\1repeat/g/\2/s/\2/i/g

Only I fell at the first hurdle because it fails to find the matching repeat 
pattern.

Is this possible? Or am I missing an easier way to do this?

Regards, Andy


-- 
Andrew Long
andrew dot long at mac dot com





Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to