Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

There are other editors that support regular expression editing. Notepad++ is another editor for Windows that supports regular expressions. How widely supported they are I can't really answer. I've got the 2 editors that I like (Vim and Notepad++) and stick with those.

Also, if any given editor has support for an add-in / extension framework then conceivably it will have support for regular expressions if / when an add-in is developed for it (if it doesn't natively have regex support already).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.