0

I have the following regex that works when used on the chrome browser:

file.match(/(?<=__\()(.*)(?=\))/g);

But it seems to throw an error when using Node on my machine:

SyntaxError: Invalid regular expression: /(?<=__\()(.*)(?=\))/: Invalid group

Any ideas why this might be? Also I am trying to match string that appear in groups like this:

__("string to match");

const file = "__('string to be extracted');";
const strings = file.match(/(?<=__\()(.*)(?=\))/g);
console.log(strings);
Asleepace
  • 3,466
  • 2
  • 23
  • 36

0 Answers0