User Tools

Site Tools


regex:numbers:decimal_places

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
regex:numbers:decimal_places [2022/09/20 23:09] – created peterregex:numbers:decimal_places [2022/09/20 23:12] (current) peter
Line 1: Line 1:
 ====== Regex - Numbers - Decimal places ====== ====== Regex - Numbers - Decimal places ======
 +
 +===== Numbers not beginning with 0 and maximum 2 decimals =====
 +
 +<code>
 +^([1-9][0-9]*)+(.[0-9]{1,2})?$
 +</code>
 +
 +----
 +
 +===== Positive or Negative numbers with maximum 2 decimals =====
 +
 +<code>
 +^(\-)?\d+(\.\d{1,2})?$
 +</code>
 +
 +----
 +
 +===== Positive or Negative numbers and any decimal length =====
 +
 +<code>
 +^(\-|\+)?\d+(\.\d+)?$
 +</code>
 +
 +----
 +
 +===== Numbers with maximum 2 decimals =====
 +
 +<code>
 +^[0-9]+(.[0-9]{2})?$
 +</code>
 +
 +----
 +
 +===== Numbers with 1-5 decimals =====
 +
 +<code>
 +^[0-9]+(.[0-9]{1,5})?$
 +</code>
 +
 +----
  
regex/numbers/decimal_places.1663715387.txt.gz · Last modified: 2022/09/20 23:09 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki