Squidly
Squidly

Reputation: 2717

Find-replace-regexp with elisp replacement not working correctly

I have a string in a buffer "THIS_IS_A_TEST" (the quotes are part of the string).

I want to turn this in to "ThisIsATest". I'm attempting to do this using a query-replace-regexp where I substitute \(\w+\)_? with \,(capitalize \1). However, the upcased words are not being capitalized.

Running M-c (capitalize-word) on any of those words works fine, and if my test string is changed to "this_is_a_test", then I get the desired result ("ThisIsATest").

What's going wrong? Is this a bug in capitalize?

(Note that this still happens without an init file loaded)

Upvotes: 2

Views: 98

Answers (1)

legoscia
legoscia

Reputation: 41578

It works for me if I set case-replace to nil. I'm not sure why this doesn't do the same thing for the lower case string, though...

Upvotes: 2

Related Questions