【发布时间】:2019-09-10 15:39:02
【问题描述】:
如果我查看文档,它说* 应该总是贪婪,但在这种情况下它不是:
// returns 'password*****' instead of 'password: *****'
'password: "something"'.replace(/(?<=password[ :]*)[^\n,]+/i, '*****')
【问题讨论】:
-
lookbehinds 通常不允许使用量词。
-
@Barmar 在 chrome 中编译正常,没有任何错误,有什么原因吗?
-
抱歉,显然 EcmaScript 允许这样做。
标签: javascript regex ecmascript-6 lookbehind