I currently want to make the first letter of a city name uppercase; but since in my country we have a lot of cities with a multiple words composed name (eg. New York), i am currently using this regex:
/\w\S*/g
so I am using this function
function capitalizeWords(myString) {
return myString.replace(/\w\S*/g, w => w.replace(/^\w/, c => c.toUpperCase()))
}
so I can change new yorkin New York.
But now I have a small issue, I have some cities like
sauze d'oulx
and I need to convert it to Sauze d'Oulx, excluding the d, or in any case the first character before the ' symbol.
What is the trick to exclude one char before a known one?