1

For instance, let's say I want to change all instances of Ctrl-m, Ctrl-p, etc., in a document to the more conventional ^M, ^P, etc. I can use :s/Ctrl-\(.\)/^\1to almost accomplish this, but it leaves the letters in lowercase where they should be in uppercase.

How can I change the case of a backreferenced regex match in a Ex-mode substitute command? (:s)

2

Perhaps like this:

:%s/Ctrl-\(.\)/^\u\1/g

For more information: :help s/\u.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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