What are the PHP regular expression meta-characters? What do we need to be aware of when we use the PHP regular expression meta-characters? So here is a detailed description of the PHP regular expression meta-character types and the method used, and so on.
PHP Regular Expression meta-character types :
Curly Braces
PLUS sign
Asterisk
Question mark
PHP Regular expression meta-characters are used specifically:
PHP Regular Expression metacharacters a class of characters in a PHP regular expression that describe the way in which the leading character (the character preceding the meta character) appears in the matched object. The meta-character itself is a single character, but different or identical meta-characters can be combined to form large meta-characters.
Curly braces: Curly braces are used to precisely specify the number of occurrences of a matching meta-character
For example, "/pre{1,5}/" means that the matching object can be "pre", "Pree", "preeeee" so that a string of 1 to 5 "E" appears after "PR". or "/pre{,5}/" on behalf of the pre appears 0 this to 5 times between.
Plus: the "+" character appears one or more times before a character is used to match a meta character
For example, "/ac+/" means that the matched object can be "act", "account", "ACCCC", and so on, after "a", one or more "C" strings. "+" equals "{1,}".
Asterisk: "*" character used to match metacharacters before characters appear 0 or more times
For example, "/ac*/" means that the matched object can be "app", "ACP", "ACCP" and so on "a" after "a" appears 0 or more "C" string. "*" corresponds to "{0,}".
Question mark: "?" Characters used to match metacharacters before characters appear 0 or 1 times
For example, "/ac?/" means that the matching object can be a "a", "ACP", "ACWP" so that a 0 or 1 "C" string appears after "a". "?" There is also a very important role in regular expressions, namely "greedy mode".
A brief introduction to the PHP regular expression metacharacters is explained here, and hopefully it will help you understand and master the PHP regular expression metacharacters.
http://www.bkjia.com/PHPjc/446587.html www.bkjia.com true http://www.bkjia.com/PHPjc/446587.html techarticle what are the PHP regular expression meta-characters? What do we need to be aware of when we use the PHP regular expression meta-characters? So here's a detailed introduction to the PHP regular expression metacharacters ...