PHP Tutorial Regular expression validation numbers
Non-negative floating-point number (positive floating point + 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 ^ (-?d+) (. d+)?
^[1-9]d*$
Match positive integers
^-[1-9]d*$
Match negative integers
^-? [1-9]d*$
Match integer
^[1-9]d*|0$
Match non-negative integers (positive integers + 0)
^-[1-9]d*|0$
Match a non-positive integer (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 numbers
^-? ([1-9]d*.d*|0.d*[1-9]d*|0?. 0+|0) $
Matching floating-point numbers
^[1-9]d*.d*|0.d*[1-9]d*|0?. 0+|0$
Match non-negative floating-point number (positive floating point + 0)
^ (-([1-9]d*.d*|0.d*[1-9]d*)) | 0+|0$
Match non-positive floating-point number (negative floating-point number + 0)
Verification Number: ^[0-9]*$
To verify N-bit numbers: ^d{n}$
Verify that at least n digits: ^d{n,}$
Verify the number of m-n bits: ^d{m,n}$
Verify numbers starting with 0 and non 0: ^ (0|[ 1-9][0-9]*) $
Verify that there is a positive real number with two decimal places: ^[0-9]+ (. [ 0-9]{2})? $
Verify that there is a positive real number with 1-3 decimal places: ^[0-9]+ (. [ 0-9]{1,3})? $
Verify non-zero positive integers: ^+? [1-9] [0-9]*$
To verify a nonzero negative integer: ^-[1-9][0-9]*$
Validates non-negative integers (positive integers + 0) ^d+$
Validates a non-positive integer (negative integer + 0) ^ ((-d+) | ( 0+)) $
Verify the character with a length of 3: ^. {3}$
?>
http://www.bkjia.com/PHPjc/445417.html www.bkjia.com true http://www.bkjia.com/PHPjc/445417.html techarticle PHP Tutorial Regular Expressions Validate numeric nonnegative floating point numbers (positive floating point + 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 ...