note 51731 deleted from function.preg-match by colder

From: Date: Mon, 18 Jun 2007 18:21:55 +0000
Subject: note 51731 deleted from function.preg-match by colder
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-127596@lists.php.net to get a copy of this message
Note Submitter: MikeS ---- 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!

« previous php.notes (#127596) next »