<p>Examples:</p>

<pre><code>"1"     yes
"-1"    yes
"- 3"   no
"1.2"   yes
"1.2.3" no
"7e4"   no  (though in some cases you may want to allow scientific notation)
".123"  yes
"123."  yes
"."     no
"-.5"   yes
"007"   yes
"00"    yes
</code></pre>

This allows for optional "+" and "-" in front.  And allows trailing or initial whitespace.
```
```
/^\s*[+-]?(?:\d+\.?\d*|\d*\.\d+)\s*$/
```
```