[pmwiki-devel] php question--stripping out non letters...

Guillermo Calderon - INCO calderon at fing.edu.uy
Thu May 17 13:09:26 CDT 2007


Christophe David wrote:
>     I was wondering if there's an easy way to strip out all characters out
>     of a string that are not letters or numbers?
> 
> 
> |preg_replace($pattern, $replacement , $string);|
> 
> 
> Try something like | ||preg_replace( '/[^a-zA-Z0-9]/', '', $string);|
> 


or something like:

                preg_replace('/\W+/','',$string)

if you also want to strip underscores:

	   preg_replace('/[\W_]+/','',$string)




More information about the pmwiki-devel mailing list