Extreme slow RegEx
Closed this issue · 1 comments
dbogatz2 commented
"hundkatzema.us AG".match(/^([\w]{3,32}( ag))/i);
takes ~20s and more is text before . gets longer - don't know which version of mujs we have in use.
regards.
ccxvii commented
Using {N,M} repetitions can lead to very inefficient regular expressions. That regular expression leads to catastrophic exponential backtracking. You can remove the problem by using * or no upper bound {3,} instead, and do the max length check after matching.
See here for technical details about exponential backtracking: https://www.rexegg.com/regex-explosive-quantifiers.html