Reading back that passage, I have to admit that it suggests that the replacement works as you expected. But as Jongware points out, the case-insensitive specification in your GREP expression has no effect on the replacement expression. Some GREP flavours do work as you expected, but Adobe's doesn't.
So the quick answer to your query is 'No, you didn't get it wrong, you were misled.'
Thanks for pointing out the problem, I'll get it changed. In the meantime, as ever, we're lucky that InDesign is so well scriptable. Many, if not most, problems can be worked around with a script. Just for interest's sake I did the script below to fix the problem you mentioned. To use it, enter the find and change expressions, then run the script. It produces the reult you expected in the first place. (It targets the whole document.)
// Input from the dialog
replacementLowerCase = app.changeGrepPreferences.changeTo;
// Input with its first letter capitalised
replacementUpperCase = replacementLowerCase.replace (/^(.)/, function () {
return arguments[0].toUpperCase();
});
found = app.documents[0].findGrep();
for (i = found.length-1; i >= 0; i--) {
firstChar = found[i].characters[0].contents;
// If the found word's first character is upper-case
// use the upper-cased variant of the replacement
if (firstChar === firstChar.toUpperCase()) {
found[i].contents = replacementUpperCase;
} else {
found[i].contents = replacementLowerCase;
}
}
Peter