I\'d like a regexp or other string which can replace everything except alphanumeric chars (a-z and 0-9) from a string. All things such as ,@#
a-z
0-9
,@#
This also works to replace anything not a digit, a word character, or a period with an underscore. Useful for filenames.
$clean = preg_replace('/[^\d\w.]+/', '_', $string);