This is my String.
var re = "i have a string";
And this my expression
var str = re.replace(/(^[a-z])/g, function(x){return x.toUpperCase();});
I want that it will make the the first character of any word to Uppercase. But the replacement above return only the first character uppercased. But I have added /g at the last.
Where is my problem?