Php note 3

Source: Internet
Author: User
Php note 3
 [A-z] */# exclude characters [^] # [^ a-zA-Z] except for characters #6 qualifier (? * + {N, m })/*? Match the first character zero or one colo? R can match color + match the previous character once or multiple times go + gle can match google to go... ogle * matches the previous character zero or multiple go * gle and can match ggle to go... ogle {n} matches the previous character n times {n,} matches the previous character at least n times {n, m} match the previous character at least n times to m times */#7 o'clock character/* can indicate any character other than the line break. for example, matching the first letter with the end letter "S" is T three-letter word ^ s. t $*/#8 escape characters/* consistent with c java */#9 backslash (\) /* the backslash defines some non-display characters, such as the \ B backspace key \ n line feed, and so on */#10 parentheses/* change the scope of the qualifier */#11 reverse reference/* reverse reference is one the memory function of the Test expression matches consecutive strings or letters. for example, if two consecutive it statements are matched, the word it is first grouped and then appended with "\ 1". The format is: (it) \ 1 // The Group sequence number represented by this 1 may have multiple scores Group */#12 pattern modifier/* I ignore uppercase/lowercase m multi-text form strings containing multiple linefeeds affect matching s single text form ^ $. you can match $ ^ x to ignore the blank character modifier in three formats :(? I) tm (? -I ),(? I: tm),/tm/I */# POSIX extension regular expression function in php/* bool erge/eregi (string pattern, string [, array regs]) search for pattern in string. if the third parameter exists, the matching strings are saved to the array. The first string is case sensitive and the second string is case insensitive. * // * bool ereg_replace/eregi_replace (string pattern, string replacement, string) match pattern in string. if the result is replaced by replacement, and the first string after replacement is returned, case-sensitive, and case-insensitive. * // * array split/split (string pattern, string [, int limit]) if you use pattern to split a string, the limit parameter is used to limit the number of splits */# PCER compatible regular expression function/* array preg_grep (string pattern, array input) the function uses the input one-to-one matching expression pattern and returns an array consisting of all successfully matched elements */$ input = array ('hellojimbo', 'nihaoajinbo '); $ pattern = '/J... o/'; $ arr = preg_grep ($ pattern, $ input); // echo sizeof ($ arr); for ($ I = 0; $ I <sizeof ($ arr); $ I ++) {echo "$ arr [$ I]
";}/* Int preg_match/preg_match_all (string pattern, string subject [, array matches]) the matching expression pattern function in the string subject returns the matching times. if matches exists, * // * string preg_quote (string str [, string delimiter]) automatically escape all special characters in str. if the delimiter parameter exists, the characters in the delimiter are also escaped. * // * preg_replace (mixed pattern, mixed replacement, mixed subject [, int limit]) matches pattern in subject, matches to replace with replacement, has limit times preg_replace_callback (mixed pa Ttern, callback, mixed subject [, int limit]) functions are the same, except that replacement can be changed to callback functions for more flexibility * // * array preg_split (string pattern, string subject [, int limit]) split string */?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.