Replacing everything other than alphanumeric, hyphen, period and underscore in a string
<p>Here is what I currently use to cleanup filenames with special characters. Basically, it should replace everything other than:</p>

<ul>
<li>Alphanumeric a-zA-Z0-9</li>
<li>Underscores _</li>
<li>Hyphens -</li>
<li><p>Period .</p>

<pre><code>echo preg_replace("/[^a-zA-Z0-9\_\-\.\s]/", "", "A\'s`kljdsg\\\`sk//dgj@@@//\/\/\#``flkl_dfd-_-sfsfs-fk kgj.docx");
</code></pre></li>
</ul>

<p>Although it seems to work, I am not sure if the _-. is the correct way of using it in a regex.</p>