You don't need a matched group. String's replace function will replace only the matched text and leave the remainder of the string unchanged.
replace
let a = "aaa yyy bbb" console.log(a.replace(/y+/, (match) => match.toUpperCase())) // 'aaa YYY bbb'