PHP regular expression: matches a specific number. PHP regular expression: matches a specific number. it is a common introduction and I hope you will get some benefits. ^ [1-9] d * $ match a positive integer ^-[1-9] d * $ match a negative integer ^ -? [1-9] d * $ match the integer ^ [1-9] d * | PHP regular expression: matches a specific number. it is a common introduction and I hope you will get some benefits.
^ [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)
Bytes. ^ [1-9] d * $ // match a positive integer ^-[1-9] d * $ // match a negative integer ^ -? [1-9] d * $ // matched integer ^ [1-9] d * |...