Is there any (?! xxx) ooo method) that can be used in js regexp

is there a / (?! xxx) ooo/ method that can be used in operation?

the results of the following concepts are equivalent to false

console.log(/(?![])/.test(""));
console.log(/(?=[^])/.test(""));

but does not include using the following method

console.log(/(?:[^])/.test(""));

Mar.06,2021

node.js 10 support can solve this problem

you can use regexp-support to know whether your environmental support supports this function

.

lookBehindPositive

  • (? < =\ $) foo
const RE_NO_DOLLAR_PREFIX = /(?<!\\$)foo/g;
'$foo %foo foo'.replace(RE_NO_DOLLAR_PREFIX, 'bar'); // => '$foo %bar bar'
Menu