Re: [PHP] Strip Everything But Letters and Numbers?

2004-09-15 Thread Jason Davidson
i think with perl regs.. as preg_replace is, you can just use a shortcut
command.. 
\w is any word char,
\d is any digit.. 
im not sure it will improve this solution any, but its something else :P

Jason

Marek Kilimajer <[EMAIL PROTECTED]> wrote: 
> 
> Jeff Oien wrote:
> > Is there an easy way to strip out everything but letters and numbers 
> > from a string? I tried searching the archives and didn't come up with 
> > much. Thanks.
> > Jeff
> > 
> 
> $string = preg_replace('/[^a-z0-9]/i', '', $string);
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Strip Everything But Letters and Numbers?

2004-09-15 Thread John Holmes
Jeff Oien wrote:
Is there an easy way to strip out everything but letters and numbers 
from a string? I tried searching the archives and didn't come up with 
much. Thanks.
$fixed = preg_replace('/[^a-zA-Z0-9]/','',$text);
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Strip Everything But Letters and Numbers?

2004-09-15 Thread Marek Kilimajer
Jeff Oien wrote:
Is there an easy way to strip out everything but letters and numbers 
from a string? I tried searching the archives and didn't come up with 
much. Thanks.
Jeff

$string = preg_replace('/[^a-z0-9]/i', '', $string);
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Strip Everything But Letters and Numbers?

2004-09-15 Thread Jeff Oien
Is there an easy way to strip out everything but letters and numbers 
from a string? I tried searching the archives and didn't come up with 
much. Thanks.
Jeff

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php