请问下面的replace是如何按照大写字母分割字符串的
replace
function spinalCase(str) { str = str.replace(/([a-z])([A-Z])/g, '$1 $2'); console.log(str); } spinalCase('ThisIsSpinalTap');
'ThisIsSpinalTap'.replace(/([A-Z]{1}[a-z]*)/g,'$1 ')
2.1m questions
2.1m answers
60 comments
57.0k users