I'm trying to convert a list of sentences to Title Case. The problem is however that with this regex the character does not get converted if it starts with a symbol. How can I get it to work?
This is a quick example:
var ls = ["this is fine" "+this is not"]
var response = ls.map(s => s.toLowerCase().replace(/^(.)|[^\w-'](\w)/gi, match => match.toUpperCase()))
I would like response to be ["This Is Fine" "+This Is Not"] and not ["This Is Fine" "+this Is Not"] like it is now.
In other words the problem is that +this is not capitalized. Same goes if I add "[this is a string]" or any other symbol.
Any ideas?
 
     
     
     
     
    