PHP common regular expressions Featured

REGEX $ = '[\ u4e00- \ u9fa5]'; // matching Chinese characters in a regular expression 

$ REGEX = '^ [\ u4E00- \ u9FA5A-Za-Z0-9] + $'; or $ REGEX = '^ [\ u4E00- \ u9FA5A-Za-Z0-9] {2,20} $ '; // Chinese, English, numbers, symbols, etc. underscore excluding 

$ REGEX =' ^ [A-zA-the Z] [A-zA _ -Z0-9] {4,15} $ '; // account is valid (starting with the letter, allowing 5-16 bytes to allow alphanumeric underlined) 

$ REGEX =' [^ \ x00- \ xFF] '; // matching double-byte characters (including characters included) 

$ REGEX = '\ n-[\ S |] * \ R & lt';   // regular expression matching blank lines 

$ REGEX . = '/ <(. *)> * < \ / \. 1> | <\ /> / '; (*.) // match the regular expression HTML tags 

$ REGEX =' (^ \ S *) | (\ S * $) ';// matching a regular expression trailing spaces 

$ REGEX = '/(\d+)\.(\d+)\.(\d+)\.(\d+)/g';// matches the IP address of a regular expression 

$ REGEX = '\ W + ([-. +] \ W +) * @ \ W + ([-.] \ W +) * \ \ W +. ([-.] \ W +) * ';   // match the regular expression Email address 

$ REGEX =' ^ (13 is [0-9] | 14 [. 5 |. 7] | 15 [0 |. 1 | 2 |. 3 |. 5 |. 6 |. 7 |. 8 |. 9 ] | 18 is [0 |. 1 | 2 |. 3 |. 5 |. 6 |. 7 |. 8 |. 9]) \ {D} $. 8 '; // phone number 

$ REGEX =' ^ [1-9] \ {D}. 5 (18 | 19 | ([23 ] \ d)) \ d {2} ((0 [1-9]) | (10 | 11 | 12)) (([0-2] [1-9]) | 10 | 20 is | 30 | 31 is) \ {D}. 3 [0-9Xx] $ '; // 18 is-bit ID number 

$ Data = "***********" ; 

IF ( the preg_match ( $ regex , $ the Data )) {
     echo "verification successful" ; 
} the else {
     echo "you entered the hell is it?" ; 
}

 

Guess you like

Origin www.cnblogs.com/yittxbug/p/10937183.html