String.prototype.replace

第一个参数是正则表达式

第二个参数是一个replacer

函数的入参如下:

replacer(match,p1,p2,p3..

其实也相当于

replacer($&,$1,$2,$3..

资料: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace

猜你喜欢

转载自www.cnblogs.com/eret9616/p/11598142.html