Regular Expression is a concise and flexible Expression for searching and replacing string patterns. It is not difficult to understand the importance. However, it is not easy to implement flexible applications without some practice. In php, there are two types of Regular Expressions: POSIX and PCRE. First, simply list the main content, and then add instructions and instances. I. POSIX (Portable Operating System Implementation for Unix), which means Unix can be transplanted to the Operating System Implementation interface. 1. ^ and $ locator 2. quantifiers or qualified words * +? {N} {n ,}{ n, m} 3. Square brackets expression [aAeEiIoOuU] character clusters of All vowels [0-9] [a-z] 4. predefined character clusters (built-in generic character clusters, specifies the processing range of characters.) [[: alpha:] uppercase/lowercase letters, same as [a-zA-Z] [[: digit:] digits, same as [0-9] [[: alnum:] uppercase and lowercase letters and numbers, same as [a-zA-Z0-9] [[: cntrl:] control characters, including Tab, return or backslash [[: space:] any white characters, including space, Tab, line feed, page feed, and carriage return ...... do not list them one by one 5. The Regular Expression Function ereg (condition, <original string>) eregi () is not case sensitive. ereg_replace (): ereg () adds the character replacement function eregi_replace () split () splits the string into arrays based on the Separator in the string form spliti () SQL _regcase () 6. POSIX Sub-Mode 2. PCRE (Perl Compatible Regular Expression) 1. Character cluster \ B \ d \ s \ t \ w 2. Use the separator/at the beginning and end of the matching expression. After the last separator, you can add modifiers I, M, S, X, U, and DU. You can also use various metacharacters, similar to POSIX locators and combinations of character clusters \ A, \ B, \ B, \ d, \ D, \ s, \ S, [], (), ^, $ ,., \, \ w, \ W 3, function www.2cto.com preg_match (): Example: preg_match ('/^ [[: alnum] {4, 8} $/', $ username) preg_match_all () preg_quote (): preg_split (): preg_grep () preg_replace (): replace preg_replace_callback ()