A Question About RegExp in Javascript
<p>Dear all, <br />
I wrote a regular expression <br />
^([+/-]?([0-9]+(.)?)|([0-9]*.[0-9]+))$ <br />
I create it by two ways <br /></p>

<pre><code>var _regex = "^([+/-]?([0-9]+(\.)?)|([0-9]*\.[0-9]+))$";
var _regexFloat = new RegExp(_regex);
</code></pre>

<p>and <br /></p>

<pre><code>var _regexFloat = /^([+/-]?([0-9]+(\.)?)|([0-9]*\.[0-9]+))$/ ;
</code></pre>

<p>the testing data is "1a" and "a1". <br />
at the second way, it work fine. <br />
but in the first way, it returns true. <br /></p>

<p>Can anyone suggest me if I have something wrong.</p>

<p>Thanks very much. <br /></p>

<p>Environment: <br /></p>

<blockquote>
  <p>Windows Server 2003 <br /> IE 6</p>
</blockquote>
