Anyone have a good preg_replace expression or even a different method of securing any variables I might want to? I'm looking to include A-Z, a-z, 0-9, and all of the SHIFT+KEY keys, and not allow any others. So, it's basically only the 'easily typable' keys.

Any help would be appreciated.. I could just make a safe array and do that, but I'm looking for a more efficient way that's only a line or two of code.

I've used this string in Perl before, but I have no idea of how to convert it over to PHP.. I tried a bit, but couldn't get it..

Code:
$str =~ s/[^A-Za-z0-9_]//gs;