PHP regular expression: match specific numbers_PHP Tutorial

WBOY
Release: 2016-07-13 17:40:49
Original
1984 people have browsed it

PHP regular expression: matching specific numbers, commonly used introduction, I hope it will be useful to everyone.
^[1-9]d*$  ​​// Match positive integers
^-[1-9]d*$  // Match negative integers
^-?[1-9]d*$  / /Match integers
^[1-9]d*|0$ //Match non-negative integers (positive integers 0)
^-[1-9]d*|0$  //Match non-positive integers ( Negative integer 0)
^[1-9]d*.d*|0.d*[1-9]d*$  ​​//Match positive floating point number
^-([1-9]d* .d*|0.d*[1-9]d*)$ //Match negative floating point number
^-?([1-9]d*.d*|0.d*[1-9] d*|0?.0 |0)$ //Match floating point number
^[1-9]d*.d*|0.d*[1-9]d*|0?.0 |0$ //Match non-negative floating point numbers (positive floating point numbers 0)
^(-([1-9]d*.d*|0.d*[1-9]d*))|0?.0 | 0$ //Match non-positive floating point numbers (negative floating point numbers 0)

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/486175.htmlTechArticlePHP regular expression: matching specific numbers, commonly used introduction, I hope it will be useful to everyone. ^[1-9]d*$ //Match positive integers^-[1-9]d*$ //Match negative integers^-?[1-9]d*$ //Match integers^[1-9] d*|...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!