php tutorial regular expression verification number
Non-negative floating point number (positive floating point number + 0): ^d+(.d+)?$
Positive floating point number ^(([0-9]+.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]* .[0-9]+)|([0-9]*[1-9][0-9]*))$
Non-positive floating point number (negative floating point number + 0) ^((-d+(.d+)?)|(0+(.0+)?))$
Negative floating point number ^(-(([0-9]+.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9 ]*.[0-9]+)|([0-9]*[1-9][0-9]*)))$
Floating point number ^(-?d+)(.d+)?
^[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 integers + 0)
^[1-9]d*.d*|0.d*[1-9]d*$
//Match positive floating point numbers
^-([1-9]d*.d*|0.d*[1-9]d*)$
//Match negative floating point numbers
^-?([1-9]d*.d*|0.d*[1-9]d*|0?.0+|0)$
//Match floating point numbers
^[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)
Verification number: ^[0-9]*$
Verify n-digit number: ^d{n}$
Verify at least n digits: ^d{n,}$
Verify m-n digit number: ^d{m,n}$
Verify numbers starting with zero and non-zero: ^(0|[1-9][0-9]*)$
Verify a positive real number with two decimal places: ^[0-9]+(.[0-9]{2})?$
Verify positive real numbers with 1-3 decimal places: ^[0-9]+(.[0-9]{1,3})?$
Verify non-zero positive integers: ^+?[1-9][0-9]*$
Verify non-zero negative integers: ^-[1-9][0-9]*$
Verify non-negative integer (positive integer + 0) ^d+$
Verify non-positive integers (negative integers + 0) ^((-d+)|(0+))$
Validate characters of length 3: ^.{3}$
?>