The following code snippet is causing Internet Explorer to throw an Unexpected Quantifier error, but Google chrome is working just fine.
var regexWord = new RegExp("\\b(?<!-)"+lWord+"\\b(?!-)");
How to fix this so it works cross browser?
UPDATE
After some testing it appears the error is a result of (?<!-)
in the regex pattern. Though, still not sure how to fix it. Seems like it is correct based on the regex documentations I've read.
Only Google Chrome supports lookbehind ?<!
So replacing (?<!-)
with [^-]
should do the trick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With