Removing single-quote from a string in php
<p>I have an HTML form that a user can input text into a <code>title</code> field, I then have php creating an HTML file called <code>title.html</code></p>

<p>My problem is that users can input spaces and apostrophes into the title field that can't be used in the html file name. I replaced the spaces with underscores by using:</p>

<pre><code>$FileName = str_replace(" ", "_", $UserInput);
</code></pre>

<p>However, I can't seem to remove single-quotes? I have tried using:</p>

<pre><code>$FileName = preg_replace("/'/", '', $UserInput); 
</code></pre>

<p>but this took <code>test's</code> and turned it into <code>test\s.html</code>.</p>
