How to limit total number of digits in a decimal number
<p>I have this regex which validates if a string is a decimal number.
Also this checks if it has at most 9 decimals after ".".</p>

<pre><code>^[-]?[0-9]+([\.][0-9]{0,9})?$
</code></pre>

<p>I need to add another check, which limits the total number of digits.</p>

<p>Mention: I need the total number of digits to be less then 38, including the decimal after the point, thus I cannot add the range just to decimals before the point.</p>

<p>valid ex: </p>

<pre><code>      -12345678901234567890123456789.123456789

      123456789012345678901234567890.1

      -1.123456789
</code></pre>