mb_ereg() cannot match over 100,000 (100K) characters (not bytes but characters)
whereas preg_match() can over 1,000,000,000 (1G, if it's within "memory_limit").
Try this.
<?php
ini_set("memory_limit", "512M"); $length = 100000; $str = "";
for ($i=0; $i<$length; $i++):
$str .= "1"; endfor;
if (mb_ereg('.*', $str)):
echo '<br><span style="background-color:lightgreen">OK!</span><br>memory_limit = '.ini_get("memory_limit").'<br>$length = '.$length;
else:
echo '<br><span style="background-color:orange">NG!</span><br>memory_limit = '.ini_get("memory_limit").'<br>$length = '.$length;
endif;
?>