mirror of
https://github.com/erusev/parsedown.git
synced 2024-09-19 19:41:29 +02:00
adjust two regex pattern within inlineLink() to reduce backtracking
add test with base64 image
This commit is contained in:
parent
20ff8bbb57
commit
48351504de
@ -1204,7 +1204,7 @@ class Parsedown
|
|||||||
|
|
||||||
$remainder = $Excerpt['text'];
|
$remainder = $Excerpt['text'];
|
||||||
|
|
||||||
if (preg_match('/\[((?:[^][]|(?R))*)\]/', $remainder, $matches))
|
if (preg_match('/\[((?:[^][]++|(?R))*+)\]/', $remainder, $matches))
|
||||||
{
|
{
|
||||||
$Element['text'] = $matches[1];
|
$Element['text'] = $matches[1];
|
||||||
|
|
||||||
@ -1217,7 +1217,7 @@ class Parsedown
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preg_match('/^[(]((?:[^ ()]|[(][^ )]+[)])+)(?:[ ]+("[^"]*"|\'[^\']*\'))?[)]/', $remainder, $matches))
|
if (preg_match('/^[(]((?:[^ ()]++|[(][^ )]+[)])++)(?:[ ]+("[^"]*"|\'[^\']*\'))?[)]/', $remainder, $matches))
|
||||||
{
|
{
|
||||||
$Element['attributes']['href'] = $matches[1];
|
$Element['attributes']['href'] = $matches[1];
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user