Web Hosting Talk







View Full Version : PHP preg_match() Fails for a long string


creativeartist
01-11-2007, 12:15 PM
Hi All,

When I was coding a CMS ,I have come across a chance to use a long text with a regaular expression.But it is working fine for short text but for long texts the execution stops there.When I have googled it saying as a bug and about pcre.Is there any way to solve the issue

Looking for help

HIU-Daniel
01-11-2007, 01:10 PM
You have to read the file line-by-line.

creativeartist
01-11-2007, 01:14 PM
It is not only for a file but also for a lone string.For short strings it is working fine

ssj4gogeta
01-11-2007, 01:42 PM
Is it not just that the php script is timing out in which case you could adjust the max execution time using set_time_limit.

creativeartist
01-11-2007, 01:47 PM
I have checked the same thing also.It is not problem with time of execution.It is something else

ssj4gogeta
01-11-2007, 02:01 PM
What about using ereg (http://uk.php.net/manual/en/function.ereg.php) instead of using preg_match

creativeartist
01-11-2007, 10:22 PM
Thanks I was plannning to use same.But for the preg_match() we have found some bugs

http://bugs.php.net/bug.php?id=38000

it is saying to use U modifier with the regular expression.It is not working for me

foobic
01-11-2007, 11:03 PM
That bug appears to be specific to version 5.1.2 and a particularly complex regexp. Can you post your php code and an example string that causes the error?