On Mon, Mar 30, at 03:00 ivan budiselic wrote:
> Hi,
> 
> I'll post a simplified version of my problem. Basically, I want to
> substitute every occurrence of 'a' (the letter a, without the quotes) with
> 'b', but only if 'a' is not inside a string, by which I mean it is not
> enclosed in double quotes.
> 
> So, for the line:
> 
> 1234 a a "a" a
> 
> I'd like to get:
> 
> 1234 b b "a" b
> 
> The question is, is this possible and how.
> 
> What I've tried is
> let line = substitute(line, '\([^\"]\{-}\)a', "\\1b", "g")

you may try:

   let line = substitute(line, '"\@<!a"\...@!', 'b', 'g')
 
see,
    
   :help zero-width

> Ivan

Regards,
Agathoklis.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to