markdown-to-jsx icon indicating copy to clipboard operation
markdown-to-jsx copied to clipboard

Resolve issue with catastrophic backtracking regex

Open Prestaul opened this issue 3 years ago • 0 comments

Catastrophic backtracking in the BREAK_THEMATIC_R regex causes parsing to hang on non-matching input with repeating asterisks like this:

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
SOME TEXT
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

or even just:

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

This minor regex change resolves that issue without changing the matched pattern or capture group.

Prestaul avatar Apr 27 '22 20:04 Prestaul