note 33979 added to function.ereg-replace
| From: | kruchta at z dot pl | Date: | Sat, 12 Jul 2003 19:27:08 +0000 |
| Subject: | note 33979 added to function.ereg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-51981@lists.php.net to get a copy of this message | ||
I had a need to remove comments from a string. They were started with '[' and ended with
']'. I tried to to this with ereg_replace, but couldn't get to it. However, I managed
to make it work with preg_replace, here's how if someone's interested:
preg_replace( '/\[[^\]]+\]/', '', $string );
Don't know why it didn't work with ereg when I removed the '/'s.
----
Manual Page -- http://www.php.net/manual/en/function.ereg-replace.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33979
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33979&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33979&report=yes