add space and replace capital letter after _ in javascript code example Example: typescript space between capital letters s = s.replace(/([A-Z])/g, ' $1').trim()