Re: Submatch expression in substitute()

2011-05-17 Thread Jürgen Krämer
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

RE: Submatch expression in substitute()

2011-05-17 Thread John Beckett
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

Submatch expression in substitute()

2011-05-16 Thread John Beckett
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