note 8739 deleted from split by ronabop
| From: | ronabop@php.net | Date: | Wed, 29 Nov 2000 05:57:35 +0000 |
| Subject: | note 8739 deleted from split by ronabop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-8248@lists.php.net to get a copy of this message | ||
cary is right, as the ereg is the greedy search in default, such that the Ur pattern will match as
much as it can find (e.g "b.+e","#","abcdefgabcdefg" match
'bcdef...bcde' rahter than 'bcde'). <br>
So if Ur php version is > 3.0.9, try use perl-style search (preg), which had option (or default,
not too sure) is not greedy search.<br>
If Ur php < 3.0.9(like me -_-;), try use esacpe the 'end' tag in pattern like that:
<br>
$var1 = ereg_replace("b[^e]+e","#","abcdefgabcdefg"); <br>
echo $var1;<br>
Hope helpful (and sorry for bad english)