note 14033 added to function.ereg-replace.php
| From: | andy at goder dot com | Date: | Sat, 14 Jul 2001 06:26:40 +0000 |
| Subject: | note 14033 added to function.ereg-replace.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-15366@lists.php.net to get a copy of this message | ||
Dear joseph@yesterdayland.com:
The reason eregi_replace does "weird things" if you do this:
$str = "This...is...awesome!";
$str = eregi_replace("...", " ", $str);
Is that the period matches any character. So you are replacing any character with a space.
The fix is to escape the period:
$str = "This...is...awesome!";
$str = eregi_replace("\.\.\.", " ", $str);
echo $str;
That will output:
This is awesome!
http://www.php.net/manual/en/function.ereg-replace.php