Home > Backend Development > PHP Tutorial > PatternModifiers-Modifiers of regular expressions (reprint) Found some regular expressions in PHP_PHP Tutorial

PatternModifiers-Modifiers of regular expressions (reprint) Found some regular expressions in PHP_PHP Tutorial

WBOY
Release: 2016-07-20 11:03:54
Original
906 people have browsed it

Pattern Modifiers - Modifiers for regular expressions
The following are the modifications available in the current regular expression. The names in brackets are the internal PCRE names of those modifiers.
i (PCRE_CASELESS)
If this is set modifier, the expression is not case-sensitive.
m (PCRE_MULTILINE)
By default, PCRE considers the target string value to be a single-line string (even if it does contain multiple lines). The line start mark (^) only Matches the beginning of the string, while the end-of-line mark ($) only matches the end of the string, or an end line (unless the E modifier is specified). This is the same as in Perl.
If this modifier is set, The start-of-line and end-of-line constructs match the current position of any new line in the target string after or before it, respectively, as with every start and end. This is equivalent to the /m modifier in Perl. If the target string does not have an "n" character, or if there is no ^ or $ in the pattern, this modifier has no effect.
s (PCRE_DOTALL)
If this modifier is set, a "dot" in the pattern will match all characters, including newlines. Without it , newlines will be excluded. This modifier is equivalent to the /s modifier in Perl. An opposite type, such as [^a] will always match newline characters, regardless of the restrictions of this modifier.
x ( PCRE_EXTENDED)
If this modifier is set, all whitespace clauses in the pattern will be ignored, unless escape characters or the internal type of a character are used, and all unescaped # signs outside the character type are also ignored. This is equivalent to the /x modifier in Perl, which allows comments to be added to complex patterns. Note that this only applies to data characters. Space characters will not appear in the specified order of pattern characters.
e
If this modifier is set, preg_replace() will perform normal substitutions involving in the replacement value, etc.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445250.htmlTechArticlePattern Modifiers - Modifiers of regular expressions The following are the modifications available in the current regular expression. The name in brackets is the internal PCRE name of those modifiers. i (PCRE_CASELESS) If...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template