User Tools

Site Tools


regex:numbers:integers

Differences

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

Link to this comparison view

regex:numbers:integers [2022/09/20 23:13] – created peterregex:numbers:integers [2022/09/20 23:14] (current) peter
Line 1: Line 1:
 ====== Regex - Numbers - Integers ====== ====== Regex - Numbers - Integers ======
 +
 +===== Positive Integer =====
 +
 +<code>
 +^\d+$
 +</code>
 +
 +or
 +
 +<code>
 +^[1-9]\d*|0$
 +</code>
 +
 +----
 +
 +===== Negative Integer =====
 +
 +<code>
 +^-[1-9]\d*|0$
 +</code>
 +
 +or
 +
 +<code>
 +^((-\d+)|(0+))$
 +</code>
 +
 +----
 +
 +===== Positive Integer, excluding 0 =====
 +
 +<code>
 +^[1-9]\d*$
 +</code>
 +
 +or
 +
 +<code>
 +^([1-9][0-9]*){1,3}$
 +</code>
 +
 +or
 +
 +<code>
 +^\+?[1-9][0-9]*$
 +</code>
 +
 +----
 +
 +===== Negative Integer, excluding 0 =====
 +
 +<code>
 +^-[1-9]\d*$
 +</code>
 +
 +or
 +
 +<code>
 +^\-[1-9][0-9]*$
 +</code>
 +
 +----
 +
  
regex/numbers/integers.1663715598.txt.gz · Last modified: 2022/09/20 23:13 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki