This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
常用的数字正则(严格匹配) | |
------------------------------ | |
正则 含义 | |
^[1-9]\d*$ 匹配正整数 | |
^-[1-9]\d*$ 匹配负整数 | |
^-?[1-9]\d*$ 匹配整数 | |
^[1-9]\d*|0$ 匹配非负整数(正整数 + 0) | |
^-[1-9]\d*|0$ 匹配非正整数(负整数 + 0) | |
^[1-9]\d*\.\d*|0\.\d*[1-9]\d*$ 匹配正浮点数 | |
^-([1-9]\d*\.\d*|0\.\d*[1-9]\d*)$ 匹配负浮点数 |