I am new to either Javascript or regex. I need to replace first word letter to the capital letter and my code does it, but it's also replacing the letter after special character or other letter (like ąčęėįš or etc.) and somehow I need to avoid it and change just only first letter. Could someone help me to solve this problem?

My code is here:

```
function capitalizeName(input) {
var name = input.val();
    name = name.toLowerCase().replace(/\b[a-z]/g, function(letter) {
    return letter.toUpperCase();
})
input.val(name);

```