note 51731 added to function.preg-match
| From: | MikeS at osu1 dot php dot net | Date: | Fri, 08 Apr 2005 20:34:40 +0000 |
| Subject: | note 51731 added to function.preg-match | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-87723@lists.php.net to get a copy of this message | ||
For anyone that's looking around for info about preg_match crashes on long stings I may have a
solution for you. After wasting 2 hours I finally found out it is a bug w/ PCRE and not a problem
w/ my input data or regex. In my case I was able to turn on UnGreedy (U modifier) and it worked
fine! Before my regex would crash on strings around 1800 chars. With no modification to the regex
aside from the ungreeder modifier I ran it on strings up to 500,000 chars long! (not that it crashed
at 500K, i just stopped trying to find a limit after that)
Of course this "fix" depends on the nature of regex and what you're trying to do.
Hope this helps someone!
----
Manual Page -- http://www.php.net/manual/en/function.preg-match.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+51731
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51731&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51731&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51731&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51731&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51731&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+51731&report=yes
Search -- http://master.php.net/manage/user-notes.php