PHP regular expression: matches a specific number. it is a common introduction and I hope you will get some benefits. ^ [1-9] d * $ & nbsp; // match a positive integer ^-[1-9] d * $ & nbsp; // match a negative integer ^ -? [1-9] d * $ & nbsp; // match the integer ^ [1-9] d * | 0 $ & nbsp; // match a non-negative integer (positive PHP regular expression: matches a specific number. this is a common introduction and is expected to be useful to you.
^ [1-9] d * $ // match a positive integer
^-[1-9] d * $ // match a negative integer
^ -? [1-9] d * $ // match the integer
^ [1-9] d * | 0 $ // match a non-negative integer (positive integer 0)
^-[1-9] d * | 0 $ // match a non-positive integer (negative integer 0)
^ [1-9] d *. d * | 0. d * [1-9] d * $ // match the positive floating point number
^-([1-9] d *. d * | 0. d * [1-9] d *) $ // match the 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 number (positive floating point number 0)
^ (-([1-9] d *. d * | 0. d * [1-9] d *) | 0 ?. 0 | 0 $ // match a non-positive floating point number (negative floating point number 0)
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service