mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03: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'];
|
||||
|
||||
if (preg_match('/\[((?:[^][]|(?R))*)\]/', $remainder, $matches))
|
||||
if (preg_match('/\[((?:[^][]++|(?R))*+)\]/', $remainder, $matches))
|
||||
{
|
||||
$Element['text'] = $matches[1];
|
||||
|
||||
@ -1217,7 +1217,7 @@ class Parsedown
|
||||
return;
|
||||
}
|
||||
|
||||
if (preg_match('/^[(]((?:[^ ()]|[(][^ )]+[)])+)(?:[ ]+("[^"]*"|\'[^\']*\'))?[)]/', $remainder, $matches))
|
||||
if (preg_match('/^[(]((?:[^ ()]++|[(][^ )]+[)])++)(?:[ ]+("[^"]*"|\'[^\']*\'))?[)]/', $remainder, $matches))
|
||||
{
|
||||
$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