Created by: Alexandre-T
Eslint produces a warning because initial regex contains a quantified group containing alternation operators and quantifiers inside. In reality, since the limiting quantifier only "repeats" the pattern three times, the pattern is rather safe, but Eslint cannot deduce that, it detect an eventual catastrophic backtracking. To get rid of the warning, the quantified group was replaced.
Here is a screenshot of the eslint warning on codacy: Here is a screenshot of the diff file: