Ingo Karkat wrote:

> On 20-Dec-2010 23:26, Christian Brabandt wrote:
> > Hi Bram,
> > when working with csv-files, I have often wished for more than 10 
> > capturing groups. So here is a patch, that allows 99 capturing groups in 
> > the replacement part. This uses the perl-like syntax ${1} until ${99} 
> > for the capturing groups in the replacement part. If there does not 
> > exist a capturing group, this will resolve to the empty string.
> > 
> > I have tested it locally and it works for me[1]. This obviously needs to 
> > be very well tested, before included. 
> > 
> > [1] running make test as well as trying several different :s commands.
> > 
> > regards,
> > Christian
> 
> I don't like the fact that this introduces another character / substring that
> needs to be escaped in the replacement text, thus breaking backward
> compatibility and making scripting more difficult. So far, only "\"
> (and "&" and
> "~" depending on 'magic', cp. :help sub-replace-special) need to be escaped.
> 
> Since that many capturing groups are rarely used (but I agree, could sometimes
> be useful), how about just making them available through submatch({nr}), as 
> in:
>     :s/{pat}/\=submatch(99)/
> 
> This would keep compatibility. Alternatively, couldn't something
> starting with a backslash be used, for example \{99}?

That's already used.  We could use \%99g, where "g" stands for group.

-- 
Q. What happens to programmers when they die?
A: MS-Windows programmers are reinstalled.  C++ programmers become undefined,
   anyone who refers to them will die as well.  Java programmers reincarnate
   after being garbage collected.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui