Due to a quirk in the domain-specific language I am working with, I frequently face the task of (selectively, not globally) replacing
This means, I search case-insensitively for
term, and want to replace that with
word while keeping the uppercase / lowercase of the original
Since checking the whole of
term for consistent upper-/lowercase would be difficult and is not really necessary, I would settle for uppercase / lowercase of
WORD being decided on the first letter of
How could I achieve this?