Using Javascript Regex For Removing Chars in String
<p>I want to create a function that will validate a string for improper chars. </p>

<p>As a first try, i tried it on numbers. It Works on IE9,  but not on Chrome 12.0.742.122 and Firefox 5 &amp; 6</p>

<pre><code>&lt;html&gt;
    &lt;head&gt;
        &lt;title&gt;Regex Example&lt;/title&gt;
        &lt;script type="text/javascript"&gt;
            var regexp;
            var input;
            var output;

            function replaceChars()
            {
                regexp = "";
                output = "";
                input = document.getElementById("myinput").getAttribute("value");
                regexp = /\d+/g;
                output = input.replace(regexp, "");//Remove Digits
                setOutput();
            }

            function setOutput()
            {
                document.getElementById("myoutput").setAttribute("value", output);
                document.getElementById("myexpr").setAttribute("value", regexp);
                document.getElementById("myinput").select();
            }
        &lt;/script&gt;
    &lt;/head&gt;

    &lt;body&gt;
        Enter : &lt;input type="text" id="myinput" value="" maxlength="25" size="25"/&gt;&lt;br/&gt;
        RegEx : &lt;input type="text" id="myexpr" value="" maxlength="25" size="25" readonly /&gt;&lt;br/&gt;
        Output : &lt;input type="text" id="myoutput" value="" maxlength="25" size="25" readonly /&gt;
        &lt;input type="button" #nClick="replaceChars();" value="Remove Digits"/&gt;
    &lt;/body&gt;
&lt;/html&gt;
</code></pre>
