-
先行断言 后行断言 匹配happy-new-year的
-后第一个字母-
str.match(/(?<=[-])(\w)/) -
str.replace(/(?<=[-])(\w)/,(x)=>{return x.toUpperCase()})replace第二个参数,接受↓
str.replace(/(?<=[-])(\w)/g,(x,y,z,k)=>{console.log(x,y,z,k)}) 结果: n n 6 happy-new-year y y 10 happy-new-year 匹配到的结果 第一个括号里的内容 结果的index 完整的内容 "happy-undefinedew-undefinedear" -