Negative lookbehind equivalent in JavaScript

Since 2018, Lookbehind Assertions are part of the ECMAScript language specification. // positive lookbehind (?<=…) // negative lookbehind (?<!…) Answer pre-2018 As Javascript supports negative lookahead, one way to do it is: reverse the input string match with a reversed regex reverse and reformat the matches const reverse = s => s.split(”).reverse().join(”); const test = … Read more