Hi,
John Beckett wrote:
I want some Vim script to remove percent encoding (where '%'
followed by two hex digits means the single character with the
given hex ASCII code, for example '%412' is 'A2').
It's easy to do this using :substitute with:
:s/%\(\x\x\)/\=nr2char('0x'.submatch(1))/g
Jürgen Krämer wrote:
you can use \= in substitute():
:echo substitute('abc%41def', '%\(\x\x\)', '\=nr2char(0x.submatch(1))', 'g')
Brilliant, thanks! I must have known that years ago??
John
--
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the
I want some Vim script to remove percent encoding (where '%'
followed by two hex digits means the single character with the
given hex ASCII code, for example '%412' is 'A2').
It's easy to do this using :substitute with:
:s/%\(\x\x\)/\=nr2char('0x'.submatch(1))/g
However, submatch() does not