RE: [PHP] ereg_replace - problem
| From: | Matthias Endler | Date: | Wed, 18 Oct 2000 15:50:31 +0000 |
| Subject: | RE: [PHP] ereg_replace - problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-20916@lists.php.net to get a copy of this message | ||
> > Hi Bertold,
> > > I need a ereg_replace-construct to erase any unshowable letters.
> > > Please look at this an 'repair'... ;-)
> > >
> > > $t = ereg_replace("[\x0-\x1f]*", "", $t);
> >
> > this is easy :)
> >
>
> sorry must be (ereg_replace doesn't seem to work):
>
> $t = preg_replace("/(.*)[\\x0-\\x1f](.*)/", "\\1\\2", $t);
you can make it a bit shorter:
$t = preg_replace("/[\\x0-\\x1f]/", "", $t);
Cheers,
Matthias