title: HTML5 input pattern decimal with negative values
body: <p><strong>I have found the following pattern:</strong></p>
  
  <pre><code>\d+(,\d{2})?
  </code></pre>
  
  <ul>
  <li>It's a regular expression that can be used in HTML5 forms.</li>
  <li>It validates the field to use comma and two decimals.</li>
  </ul>
  
  <p><strong>It can be used on a text box like this:</strong></p>
  
  <pre><code>&lt;input type="text" pattern="\d+(,\d{2})?" required&gt;
  </code></pre>
  
  <p><strong>Question</strong></p>
  
  <p>The pattern works fine except for one thing. It can't handle negative values. How can I modify it to accept negative values?</p>
  
  <p><strong>Result should be</strong></p>
  
  <ul>
  <li>abc - false</li>
  <li>123 - true</li>
  <li>abc,12 - false</li>
  <li>123,12 - true</li>
  <li>-123,12 - true</li>
  <li>-123 - true</li>
  </ul>
  
  <p>The last two don't work with the current pattern.</p>