PHP - preg_match(): Compilation failed

Clodoaldo Pinto clodoaldo.pinto at gmail.com
Tue Sep 5 11:12:06 UTC 2006


preg_match(): Compilation failed: regular expression too large at offset 0

The regular expression is 34,745 bytes long.

<?php
$regExp = 'huge regexp with 34,745 bytes';
echo '<pre>strlen($regExp) = ', strlen($regExp), "\n";
echo preg_match($regExp, 'sudokusweb.com');
echo '</pre>';
?>

This error shows in Fedora Core 5 - PHP 5.4.1

The same code works in a shared host running PHP 4.3.11:

http://allthehosts.com/testregex.php

The code including the regexp can be downloaded from:

http://allthehosts.com/testregex.txt

LIMITATIONS section of http://www.pcre.org/pcre.txt

"The  maximum  length of a compiled pattern is 65539 (sic) bytes if
PCRE is compiled with the default internal linkage size of 2."

Then I suppose FC5 does not compile it with the default size of 2. Why?

Regards, Clodoaldo Pinto




More information about the fedora-list mailing list