Today I had the need to change all url encoded strings like %BF
to lower case ones like %bf
. My first reaction is to write some Ruby scripts to do this conversion, and I began to consider use the gsub
function like this gsub(/%(\d|[ABCDEF]){2}/, '\1')
and then I realized that I can't change the case of the back reference.
I wondered if I can change the case of back reference and googled. I find that Vim has this ability. Here's the command that can achieve my goal:
%s,%\(\d\|[ABCDEF]\)\{2},\L&,g
Here the \L
prefix means change the matched text (specified by &
) to lower case.
I'm just wondering if this feature is specific to Vim, or is it also supported by other editors?