var str = 'user-select'; str = str.replace(/-([a-z])/g, function(a, b) { return b.toUpperCase() }); alert(str);