Re: Stripping Characters
| From: | Richard Quadling | Date: | Wed, 23 Jun 2010 09:41:47 +0000 |
| Subject: | Re: Stripping Characters | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-306349@lists.php.net to get a copy of this message | ||
On 23 June 2010 01:03, Rick Dwyer <rpdwyer@earthlink.net> wrote:
> $find = '/[^a-z0-9]/i';
Replace that with ...
$find = '/[^a-z0-9]++/i';
And now you only need ...
$new_string = trim(preg_replace($find, $replace, $old_string));
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling