var str = "transition-timing-function";
var reg = /-([A-z])/g;
var res;
while (res = reg.exec(str)) {
var reg_str = res[0]; // 目標
var repalce_str = res[1].toUpperCase(); // 捕獲組
var _reg = new RegExp(reg_str);
str = str.replace(_reg, repalce_str);
}
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
var str = "transition-timing-function";
str = str.replace(/\-([a-z])/g, function(all, catchGroup) {
return catchGroup.toUpperCase();
});
console.log(str);
///////////////////////////////////////////////////////
var str = "transitionTimingFunction";
while (/[a-z][A-Z]/.test(str)) {
str = str.replace(/([a-z])([A-Z])/, '$1-$2');
}