PHP using urldecode with regex
<p>I'm trying to use this line of code to accept URL variables with spaces replaced by '%20' but it also has to go through a regex </p>

<pre><code>$type=urldecode(ereg_replace("[^a-zA-Z0-9%]+", "", @$_REQUEST['type']));
</code></pre>

<p>The result is just the %20 removed instead of replacing with a space e.g JohnDoe not John Doe, from John%20Doe</p>
