User Tools

Site Tools


regex:numbers

This is an old revision of the document!


Regex - Numbers

0 and numbers not beginning with 0

Decimal places

Floating-point

Numbers only

Minimum number of digits

Range of digits

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

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki