title: Regular expression for 3 decimal point
body: <p>I need a regular expression that satisfy these rules:</p>
  
  <ol>
  <li>The maximum number of decimal point is 3 but a number with no decimal point (e.g 12) should be accepted too</li>
  <li>the value must be at least 0</li>
  <li>the value must be less or equal to 99999999999.999</li>
  <li>the radix point is DOT (e.g 2.5, not 2,5)</li>
  </ol>
  
  <p><b>Sample of valid numbers:</b></p>
  
  <pre><code>0
  2
  0.4
  78784764.23
  45.232
  </code></pre>
  
  <p><b>Sample of invalid numbers:</b></p>
  
  <pre><code>-2
  123456789522144
  84.2564
  </code></pre>
  
  <p>I found an example here (http://forums.asp.net/t/1642501.aspx) and have managed to modify it a little bit to make 0 as the minimum value, 99999999999.999 as the maximum value and to accept only DOT as radix point. Here's my modified regex:</p>
  
  <pre><code>^\-?(([0-9]\d?|0\d{1,2})((\.)\d{0,2})?|99999999999.999((\.)0{1,2})?)$
  </code></pre>
  
  <p>However, I still have problem with the 3 decimal point and it is rather unstable. Can anyone help me on this since I'm basically illiterate when it comes to regex?</p>
  
  <p>Thanks. </p>
  
  <p><b>EDITED:</b>
  I'm using ASP Regular Expression Validator</p>