User Tools

Site Tools


regex:numbers:floating-point

This is an old revision of the document!


Regex - Numbers - Floating-point

Floating-point

^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$

Positive floating-point

^[1-9]\d*\.\d*|0\.\d*[1-9]\d*$

or

^[1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0$

Negative floating-point

^((-\d+(\.\d+)?)|(0+(\.0+)?))$

or

^-([1-9]\d*\.\d*|0\.\d*[1-9]\d*)$

or

^(-([1-9]\d*\.\d*|0\.\d*[1-9]\d*))|0?\.0+|0$

or

^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$

regex/numbers/floating-point.1663715076.txt.gz · Last modified: 2022/09/20 23:04 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki