Like dfsq , the problem is related to the word. If you delete \b , you will get the desired result, but this is a completely different regular expression. He will replace One also in those cases when he is part of the word. To avoid this, you can use a negative lookahead and determine which letters should not appear behind, because they can be part of the word.
''.replace(/\(?![A-])/gi, '');
source share