Wednesday, April 9, 2014

Re: systematic replacement of text

* Natércia Fernandes [2014.04.09 07:02]:
> In a file with many occurrences of something like this:
>
> \xxx{a variable number of words that I want to delete}{a variable (diferent)
> number of words that I want to keep}

[...]

> Don't know if this info is needed or not: both argument 1 and/or argument 2
> can contain the symbols \ {}.

Not only is it needed, it changes everything.

I was going to suggest:

:%s/\\xxx{\_[^}]*}{\(\_[^}]*\)}/\1/g

But that won't work if the arguments can contain
'}'. That simple fact makes the problem a lot
harder.

--
JR

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