Optimise commonly used regexes to fail fast
This commit is contained in:
parent
dc5cf8770b
commit
d6e306d620
|
@ -1218,12 +1218,12 @@ class Parsedown
|
|||
|
||||
if ($this->breaksEnabled)
|
||||
{
|
||||
$Inline['element']['rawHtml'] = preg_replace('/[ ]*\n/', "<br />\n", $safeText);
|
||||
$Inline['element']['rawHtml'] = preg_replace('/[ ]*+\n/', "<br />\n", $safeText);
|
||||
$Inline['element']['allowRawHtmlInSafeMode'] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$Inline['element']['rawHtml'] = preg_replace('/(?:[ ][ ]+|[ ]*\\\\)\n/', "<br />\n", $safeText);
|
||||
$Inline['element']['rawHtml'] = preg_replace('/(?:[ ]*+\\\\|[ ]{2,}+)\n/', "<br />\n", $safeText);
|
||||
$Inline['element']['allowRawHtmlInSafeMode'] = true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue