Regressed Regex with 999998+ groups now raises an InternalError

Published: | Categories: JavaScript

Description

Starting with Firefox 29, regular expressions with more than 999998 groups will not work, rather raise an InternalError say “an error occurred while executing regular expression”. This change aims to improve both performance and security by preventing the counters from being overflowed. See Egor Homakov’s blog post for details.

Regressions from this change have been reported that some specific regular expressions wrongly cause an InternalError where the regex previously claimed “no match” even if they should be matched. It has been discovered that the trim function in older versions of jQuery is also affected. This issue has been fixed with Firefox 30.

References