Tuesday, April 16, 2013

Re: substitution with accented characters

On Tuesday, April 16, 2013 8:52:22 PM UTC-5, andalou wrote:
> Suppose I have the following text:
>
> Diagonalización de matrices. Formas cuadráticas.
> El Espacio Afín
> El problema de la Programación Lineal
> El Espacio Euclídeo
>
> How can I replace the &#...; with their corresponding characters?
>
> I know that ó is ó
> á is á
> í is í
>
> The text can be very large with several of the &#...;
>

Are you looking for something like this?

:%s/&#\(\d\+\);/\=nr2char(submatch(1))/g

:help sub-replace-expression
:help submatch()
:help nr2char()

Depending on your encoding you might need to throw in an iconv() call somewhere.

--
--
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/groups/opt_out.

No comments: