note 33979 rejected from function.ereg-replace by didou
| From: | didou@php.net | Date: | Wed, 24 Sep 2003 17:17:13 +0000 |
| Subject: | note 33979 rejected from function.ereg-replace by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-57062@lists.php.net to get a copy of this message | ||
Note Submitter: kruchta@z.pl
----
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.