in reply to Case-preserving regexp search and replace?

Not sure what you are needing this to do but the following would preserve clarity as to what was going on.

#in a loop s/[A-Z]+/REPLACE/, next; s/[a-z]+/replace/, next; s/[A-Z][a-z]+/Replace/, next;

If its simple letter translation you could of course use tr/// which would keep your cases straight.