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)

1 Answer 1

2

Perhaps like this:

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

For more information: :help s/\u.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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