正则表达时,贪婪模式,.*会一直匹配到最后一个
// 验证 let str = "hello world"; let res = str.replace(/(.*)l/,'$10'); //$1 + 替换后的字符 console.log(res); // hello wor0d
正则表达时,贪婪模式,.*会一直匹配到最后一个
// 验证 let str = "hello world"; let res = str.replace(/(.*)l/,'$10'); //$1 + 替换后的字符 console.log(res); // hello wor0d
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。