Regexp: Remove no alnum chars from a string

Posted by poru on Stack Overflow See other posts from Stack Overflow or by poru
Published on 2010-05-11T14:38:43Z Indexed on 2010/05/11 14:44 UTC
Read the original article Hit count: 157

Filed under:
|

Hello,

how could I remove all charakters from a string that aren't a-z/A-Z and 0-9 and _ with PHP? I tried that but it has no effect, it returns the same string back:

preg_replace('[^a-zA-Z0-9_]', '', 'Testdo123_-:=)§%&');

© Stack Overflow or respective owner

Related posts about regex

Related posts about php