regex:numbers
This is an old revision of the document!
Regex - Numbers
0 and numbers not beginning with 0
Specific number of digits only
Positive Integer, excluding 0
^[1-9]\d*$
or
^([1-9][0-9]*){1,3}$
or
^\+?[1-9][0-9]*$
Negative Integer, excluding 0
^-[1-9]\d*$
or
^\-[1-9][0-9]*$
Positive Integer
^\d+$
or
^[1-9]\d*|0$
Negative Integer
^-[1-9]\d*|0$
or
^((-\d+)|(0+))$
regex/numbers.1663715409.txt.gz · Last modified: 2022/09/20 23:10 by peter