in reply to Replacing characters in a line

Just use "word-boundary anchors" in your regex:
/\bD\b/

pelagic