Wednesday, October 22, 2014

Re: replace submatches in matchlist

On Mi, 22 Okt 2014, BimbaLaszlo wrote:

> I don't understand what do you like to tell me... o_O The matchlist()
> gives me all of the submatches, but i like to modify the values of
> those, then "compile" the original line again.
>
> * Get the submatches from line ('some AfooBar' -> 'A', 'B'),
> * modify those ('A' -> 'C', 'B' -> '),
> * 'compile' the original line. ('some CfooDar'

Because it is not possible to to so ;)
I must admit, I do not entirely understand what you want, I just think
the closest you'll get is using submatch() to access your various
subpatterns and since you talked about modifying complete lines, that's
what the :s command is for.
(Note, for complex things, you can call a function in the replacement
part, and I think in that function you still have access to all those
submatches(), so that would be my first try).

Best,
Christian
--
Wie man sein Kind nicht nennen sollte:
Hans Dampf

--
--
You received this message from the "vim_use" 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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment