|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-07-25 11:51 UTC] stefanbocskai at hotmail dot com
hi I used the regexp functions (ereg and eregi) to split a file in blocks, the delimiters are somthing like: <!-- BEGIN BLOCK: main --> <!-- END BLOCK: main --> but the split operation failt if the file size is bigger then (aproximative value) 11k So, this is a bug or this was already specified in some place? Stefan PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 07:00:01 2025 UTC |
Unable to reproduce, see the following code: <?php $string = str_repeat("0", 10000)."abc".str_repeat("0", 10000); echo ereg("abc", $string)?"true":"false"; ?> Returns true. Can you post a snippet of your code?Hi and thanks for your interrest! Here is an example to ilustrate my problem! I'm not sure if is a memory problem or a bug. I copyed and adapted a part of my source: <?php $LEN=5000; //-- is not working //$LEN=1000; //-- is working // creating a long string containg a sub "block" $BlockTemplate=str_repeat("0", $LEN)."<!-- BEGIN BLOCK: abc -->".str_repeat("I", $LEN)."<!-- END BLOCK: abc -->".str_repeat("0", $LEN); $BLOCKS=array(); function _createChildren_(){ global $BlockTemplate,$BLOCKS; $part="[a-z,0-9,\_]*"; $_start_tag_ = "<!--"; $_end_tag_ = "-->"; $_begin_block_ = "BEGIN[[:blank:]]*BLOCK:"; $_end_block_ = "END[[:blank:]]*BLOCK:"; // creating pattern ... $patern_begin = $_start_tag_."[[:blank:]]*".$_begin_block_."[[:blank:]]*(".$part.")[[:blank:]]*".$_end_tag_; $patern_end1 = $_start_tag_."[[:blank:]]*".$_end_block_."[[:blank:]]*"; $patern_end2 = "[[:blank:]]*".$_end_tag_; while ((eregi("(".$patern_begin.")(.*)$",$BlockTemplate,$res))&&(eregi("^((.*)".$patern_end1.$res[2].$patern_end2.")", $res[3], $res2))){ // now $res2[2] is the content of the new block // and $res[2] is the name ... // colecting in $BLOCKS the block contain if was found $BLOCKS[$res[2]] = $res2[2]; $patern = $res[1].$res2[1]; $BlockTemplate = str_replace($patern,"{ABC.".$res[2]."}", $BlockTemplate); }//while } //the following will extract all chlidren block from text ... _createChildren_(); //if the block was found will be printed echo "--".$BLOCKS["abc"]."--"; ?> This problem apears only on php4.0.4pl1 Thanks for your collaboration! Stefan