I have the following string:
A new way's to get home
Output need to be:
A New Way's To Get Home
I try with this code:
var string = "A new way's to get home";
string = string.replace(/\(\d+\)/g, '').trim().replace(': ', ' - ').replace(/\b[a-z]/g,function(f){return f.toUpperCase();});
alert(string);
But i get this:
A New Way'S To Get Home
I need to get all string at begginning to uppercase but here the problem is Way'S because it contains ' and this regex above need to return 's not 'S how i need to rewrite this regex to return correct value?