Re: ereg_replace help
| From: | John W. Holmes | Date: | Thu, 18 Mar 2004 15:35:15 +0000 |
| Subject: | Re: ereg_replace help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-180841@lists.php.net to get a copy of this message | ||
From: "Richard Davey" <rich@launchcode.co.uk>
> I'm sure this is blindingly simple, but could anyone tell me how to
> get an ereg_replace() to return a string where all characters OTHER
> than alpha-numerics have been stripped out?
$output = ereg_replace('[^a-zA-Z0-9]','',$string);
The ^ is NOT (when the first character in a bracketed character set). So
anything NOT alphanumeric is replaced.
---John Holmes...