Babel implementation of "ES2018: RegExp lookbehind assertions"?

Viewed 1215

This works fine in Chrome

const expression = '(?<=\\d) (\\d\\d\\d)';
const regex = new RegExp(expression, 'gmi');
'123 456'.replace(regex, 'z$1')
// 123z456

However using karma with babelify I get the following error with phantomjs

SyntaxError: Invalid regular expression: unrecognized character after (?

and with Firefox 62.0.0

SyntaxError: invalid regexp group (same as when using the browser directly)

Is there a plugin that I'm missing ?

http://2ality.com/2017/05/regexp-lookbehind-assertions.html

https://babeljs.io/docs/en/plugins/#es2018

0 Answers
Related