I want to capitalize the first letter of each string inside the brackets...
If we have this string:
const text = 'This [forest or jungle] is [really] beautiful';
The desired result would be 'This [Forest or jungle] is [Really] beautiful'
So far:
I have the capitalize function:
function capitalize(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
And here we have this regex code to select string inside the brackets:
/(?<=\[)(.*?)(?=\])/g
Please help