From: Richard Quadling on
On 23 June 2010 01:03, Rick Dwyer <rpdwyer(a)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