note 8739 added to split
| From: | martin at hkhotmail dot com | Date: | Tue, 26 Sep 2000 15:04:40 +0000 |
| Subject: | note 8739 added to split | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-5430@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)
http://www.php.net/manual/function.split.php