Wednesday, April 9, 2014

Re: systematic replacement of text

On Wed, 9 Apr 2014 at 11:09am +0100, Natércia Fernandes wrote:

> \xxx{argument 1}{argument 2} can exist more than once in a line, but never
> will exist a \xxx in the arguments of another \xxx.
>
> If "argument 1" and "argument 2" were kept in all occurrences, I could solve
> my problem with something like this:
> :1,$ s/\\xxx{argument 1}{argument 2}/argument 2/g
> but my problem is that argument 1 and argument 2 are different from occurrence
> to occurrence.

A possibility is to do

:%s/\\xxx{\_.\{-}}{\(\_.\{-}\)}/\1/g

Possibly there are solutions with less characters.

Best,
Claus

--
--
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