Currently I'm running the following replacement approach ...
const str = '<span style="font-weight:bold;color:Blue;">ch</span>edilpakkam,tiruvallur';
const rex = (/(\b[a-z])/g);
const result = str.toLowerCase().replace(rex, function (letter) {
//console.log(letter.toUpperCase())
return letter.toUpperCase();
});
console.log(result);
.as-console-wrapper { min-height: 100%!important; top: 0; }
... with a source of ...
<span style="font-weight:bold;color:Blue;">ch</span>edilpakkam,tiruvallur
... and the following result ...
<Span Style="Font-Weight:Bold;Color:Blue;">Ch</Span>Edilpakkam,Tiruvallur
But what I want to achieve are the following points ...
- Bind span to string.
- Uppercase 1st letter and word after.
- Expected output
<span style="font-weight:bold;color:Blue;">Ch</span>edilpakkam,Tiruvallur