title: regular expression for decimal digit validation
body: <p>Regular expression for C# data annotations to validate a optional decimal number with below conditions</p>
  
  <ul>
  <li>max eleven digits starting with any digit between 0-9 (after lead zeros count should be 11)</li>
  <li>max eleven digits with a decimal point starting with any digit between 0-9, count with
  decimal should not exceed 11</li>
  <li>it cannot be just a zero</li>
  <li>only one decimal allowed in the whole number but decimal is not required</li>
  </ul>
  
  <p><strong>example:</strong> </p>
  
  <pre><code>12345678910
  10.3
  0.02
  18.2578
  012345678.9 
  0.123456789 
  012345678912 (since lead zero doesn't count as a valid number count 
                of max 11 is after zeor)
  0.123456789 (since this number has decimal lead zero counts to the 
               total 11 digit count)
  0.001
  </code></pre>
  
  <p>So far I have come-up with something like this <code>^(?=.{1,11}$)([1-9][0-9]*|0)(\\.[0-9]*[1-9])?$</code> but this is not working for all cases</p>
  
  <p>this is how I set data annotation</p>
  
  <pre><code> [RegularExpression(@"(?&lt;![.\d])0*(?:[1-9][0-9]{10}|(?![0-9.]{14})(?:0\.[0-9]*[1-9][0-9]*|[1-9][0-9]*\.[0-9]+))(?![0-9.])\z", ErrorMessage = "Invalid {0}")]
          public decimal Quantity { get; set; }
  </code></pre>