Common regular operation php

REGx $ = "/ ^ [0-9] * $ /" ;
 var_dump ( the preg_match ( $ REGx , $ Phone )); 


conventional regular operation: 
• verifying the digital: ^ [0-9] * $ 
• authentication n bits digital: ^ \ n {D} $ 
• at least n-bit digital verification: ^ \ D {n, } $ 
• authentication m digital bits -n: ^ \ D {m, n} $ 
• beginning zero and non-zero verification digital: ^ (0 | [1-9] [0-9] * ) $ 
• verify that there are two positive real number of decimal places: ^ [0-9] + ([0-9] {2}.)? $ 
• verify 1 3 position decimal positive real numbers: (. [0-9] {l, 3})? ^ [0-9] + $ 
• authentication nonzero positive integer: ^ \ + [1-9]? [0-9] * $ 
• authentication negative integer zero: ^ \ - [1-9] [0-9] * $ 
• verify non-negative integer (integer + 0) ^ \ d +$ 
• Verify non-positive integer (negative integer + 0) ^ ((- \ D +) | (0+ )) $ 
• authentication character of length 3 of: ^ {3 } $ 
character • verified by the 26 English letters string: ^ [a-Za-Z] + $ 
• authentication string 26 by a capital English letters: ^ [AZ] + $ 
• authentication string written letters consisting of a small 26: ^ [AZ] + $ 
• verification string of numbers and English letters 26: ^ [a-Za-Z0-9] + $ 
• authentication string of digits, letters or underscore 26 consisting of: ^ \ W + $ 
• user authentication password : ^ [a-zA-Z ] \ w {5,17} $ correct format: beginning with the letter, 6- length between 18, only contain characters, numbers and underscores. 
• Verify containing ^ &% '; $ = \ "characters such as: [^% &?'; $ = \ X22?] + 
• verification Character: ^ [\ u4e00- \ u9fa5], {0, } $ 
• verify Email address: . ^ \ w + [-. +] \ w +) * @ \ w + ([-.] \ w +) * \ \ w + ([-.] \ w +) * $ 
• verify InternetURL:HTTP ^: // (. [\ W -] + \) + [\ W -] + (/ [\ w-./?%&=]*)?$; ^ [A-zA-Z] +: //(w+(-w+)*)(.(w+(-w+)*))*(?S*)?$ 
• verify the phone number: ^ (\ d3,4 \ d3,4 | \ d {3, 4} -) \ d {7,8 } $: -? correct format is: XXXX-XXXXXXX, the XXXXXXXX-XXXX, XXX-XXXXXXX, XXX - the XXXXXXXX, XXXXXXX, the XXXXXXXX. 
• Verify ID number (15 or 18 digits): ^ \ d {15} | \ d {18} $ 
• Verify the year 12 months: ^ (0 [1-9] | 1 [0-? 2]) $ the correct format: "01" - "09" and "1", "12 " 
• verify month of 31 days: ^ (? (0 [1-9]) | ((1 | 2) [0 -9]) | 30 | 31) $ format is correct: 01,09 and 1,31 . 
• Integer: ^ - \ d +? $ 
• non-negative floating-point numbers (positive float + 0): ^ \ d + (\ \ d +.)? $ 
• positive float    ^ (([0-9] + \ [0. -9] * [1-9] [0-9 ] *) | ([0-9] * [1-9] [0-9] * \ [0-9] +) |. ([0-9 ] * [1-9] [0-9] * )) $ 
• non-positive float (negative float + 0) ^ ((- \ d + (\ \ d +.)) |?. (0 + (\ 0 +)?)) $ 
• negative float   ^ (- (([0-9] + \ [0-9] * [1-9] [0-9] *.) | ([0-9] * [1-9 .] [0-9] * \ [0-9] +) | ([0-9] * [1-9] [0-9] * ))) $ 
• float   ^ (- \ d +) ( ? \. \ d +)?

 

Guess you like

Origin www.cnblogs.com/tmdsleep/p/11276008.html