From: wchenny <wch...@gm...> - 2008-06-27 18:06:06
|
Hi, All, I encountered this strange problem while using function preg_match in InlineParser.php. I isolates the problem and put it in the following php code. </p>match result <?php $text = str_repeat('*', 12500); $regexp = "/ ( . *? ) ( ($)|(~(?: [[:alnum:]]+ | .))|(\\#? \\[ .*? [^] \\s] .*? \\]) ) /Asx"; if($text and $regexp) $ret = preg_match($regexp, $text, $m); echo $ret; ?> <br /> </p>regexp is <?php echo $regexp; ?> <br /> </p>text length <?php echo strlen($text) ?> <br> <?php echo "count ".count($m)."<br>"; for ($i=0; $i<count($m); $i++) { $str=$i.htmlentities($m[$i])."<br>"; echo $str; } ?> <br /> when I set the line: $text = str_repeat('*', 12500); preg_match will return 0 for the hard coded regular expression. but if I set $text to 12499, it will return 1 for a match. $text = str_repeat('*', 12499); anybody know what's the problem? Thanks! -- View this message in context: http://www.nabble.com/help%21-strange-preg_match-no-match-problem%21-tp18159550p18159550.html Sent from the phpwiki-talk mailing list archive at Nabble.com. |