note 126368 added to function.preg-match-all
| From: | harrybarrow.mail.ru via php-notes | Date: | Fri, 27 Aug 2021 23:50:49 +0000 |
| Subject: | note 126368 added to function.preg-match-all | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-216830@lists.php.net to get a copy of this message | ||
preg_match_all() and other preg_*() functions doesn't work well with very long strings, at
least longer that 1Mb.
In this case case function returns FALSE and $matchers value is unpredictable, may contain some
values, may be empty.
In this case workaround is pre-split long string onto parts, for instance explode() long string by
some criteria and then apply preg_match_all() on each part.
Typical scenario for this case is log analysis by regular expressions.
Tested on PHP 7.2.0
----
Server IP: 45.112.84.4
Probable Submitter: 45.112.85.242 (proxied: 212.232.79.200)
----
Manual Page -- https://php.net/manual/en/function.preg-match-all.php
Edit -- https://main.php.net/note/edit/126368
Del: integrated -- https://main.php.net/note/delete/126368/integrated
Del: useless -- https://main.php.net/note/delete/126368/useless
Del: bad code -- https://main.php.net/note/delete/126368/bad+code
Del: spam -- https://main.php.net/note/delete/126368/spam
Del: non-english -- https://main.php.net/note/delete/126368/non-english
Del: in docs -- https://main.php.net/note/delete/126368/in+docs
Del: other reasons-- https://main.php.net/note/delete/126368
Reject -- https://main.php.net/note/reject/126368
Search -- https://main.php.net/manage/user-notes.php