Regular Expressions (Regular expression) are concise and flexible representations of the find and replace string patterns. Importance is no longer mentioned, it is not difficult to understand, but without certain practice, it is not easy to apply flexibly. In PHP, there are two types of regular expressions for POSIX and pcre. First, simply list out the main content, and then add a description and examples. One, POSIX (Portable Operating System implementation for UNIX), which means implementing interfaces for UNIX portable operating systems. 1, ^ and $ locator 2, quantifier or qualifier * +? {n} {N,} {n,m}3, bracket expression [aaeeiioouu] character clusters for all vowel characters [0-9] [a-z]4, predefined character clusters (built-in universal character cluster, specified character processing range) [[: Alpha:]] uppercase and lowercase letters, with [a-za-z] [[: Digit:]] numbers, with [0-9] [[: Alnum:]] uppercase and lowercase letters and numbers, with [a-za-z0-9] [[: Cntrl:]] control characters, including Tab, backspace, or backslash [[: space:]] any white characters, including spaces, tabs, line breaks, Page change and carriage return ... Do not enumerate 5, the regular expression function ereg (condition, <原始字符串> ) eregi () is not case-sensitive ereg_replace (): Ereg () is added on the basis of the character substitution function eregi_replace () split () for delimiter pairs in a string split array form Spliti () sql_regcase () 6, POSIX sub-mode two, PCRE (Perl Compatible Regular expression) 1, character cluster \\b \\d \\s \\t \\w 2, match expression start and end use delimiter/, last delimiter/after, can add adornments Characters I, M, S,x,u,du can also use a variety of meta-characters, such as POSIX-like locators and a combination 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 () : Add the Italian character preg_split (): Preg_grep () preg_replace (): Replace Preg_replace_callback ()
http://www.bkjia.com/PHPjc/477713.html www.bkjia.com true http://www.bkjia.com/PHPjc/477713.html techarticle Regular Expressions (Regular expression) are concise and flexible representations of the find and replace string patterns. Importance is no longer mentioned, it is not difficult to understand, but if there is no certain practice, do ...