https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17097754782013-04-28T07:35:39ZRuby Issue Tracking SystemRuby master - Bug #8287: Regexp performance issuehttps://bugs.ruby-lang.org/issues/8287?journal_id=389682013-04-28T07:35:39Zko1 (Koichi Sasada)
<ul><li><strong>Category</strong> set to <i>core</i></li><li><strong>Assignee</strong> set to <i>naruse (Yui NARUSE)</i></li></ul> Ruby master - Bug #8287: Regexp performance issuehttps://bugs.ruby-lang.org/issues/8287?journal_id=805422019-08-09T23:24:55Zjeremyevans0 (Jeremy Evans)merch-redmine@jeremyevans.net
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Rejected</i></li><li><strong>Backport</strong> deleted (<del><i>1.9.3: UNKNOWN, 2.0.0: UNKNOWN</i></del>)</li></ul><p>From the general problem statement, and looking at the regexp's nested use of <code>*</code> and <code>+</code> along with <code>\g</code>, this regexp probably exhibits exponential backtracking. See <a href="https://docs.ruby-lang.org/en/2.6.0/Regexp.html#class-Regexp-label-Performance" class="external">https://docs.ruby-lang.org/en/2.6.0/Regexp.html#class-Regexp-label-Performance</a>. You would need to fix the regexp to avoid the backtracking, possibly using <code>(?></code> for some capture groups. I can't confirm that because as displayed, the regexp is not valid Ruby code (I'm guessing a previous Redmine update broke the syntax used).</p>