> I am doing this job for each line of a 4000 lines files : > > let l:lineArranged = substitute(l:lineArranged, 'foo1', 'BAR1', "") > let l:lineArranged = substitute(l:lineArranged, 'foo2', 'BAR2', "") > ... > .. > let l:lineArranged = substitute(l:lineArranged, 'foo7', 'BAR7', "")
Can an item appear more than once (for which you only want to replace the first match), or is it okay to use the "g" flag? If you can do all of them, I'd just use (check for levels of escaping, as I'm not sure the "\ze" should be "\\ze"...it's untested, but close enough to get you the idea) substitute(l:lineArranged, 'foo\ze[1-7]', 'bar', 'g') I see you're still trying to do this with variables rather than dealing with lines in a buffer -- you'll find Vim affords many more conveniences for working with lines-in-buffers than it does for manipulating variables. So I'll continue to urge you to consider changing your methodology, even if you continue to disregard it :) -tim -- You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php
