'Regex to Upper Case all words but exclude ' (apostrophe)

I'm trying to build a funct to UpperCase all the string words but I'm having a problem with the following:

String.prototype.upper = function() {
    return this.replace(/[^a-zA-Z0-9]+(.)/g, chr => chr.toUpperCase())
 }


let str = "My uncle's car is red";
console.log(str.upper()) 


//My Uncle'S Car Is Red

I need to exclude the S from being UpperCased, after the apostrophe.

Any ideas how this can be done?

Thank you



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source