PatternModifiers-modifier of the rule expression (reprinted) found some regular expressions in PHP

Source: Internet
Author: User
Tags modifier modifiers
Pattern Modifiers-modifier of the rule expression
The following are the modifiers available in the current rule expression. The names in the brackets are the internal PCRE names of the modifiers.
I (PCRE_CASELESS)
If this modifier is set, the expression is case-insensitive.
M (PCRE_MULTILINE)
By default, PCRE considers the target string value as a single-line string (even if it does contain multiple rows ). the row start mark (^) matches only the start part of the string, while the row end mark ($) matches only the end of the string, or an end line (unless the E modifier is specified ). this is the same as that in Perl.
If this modifier is set, the row start and end structures match the current position or the previous one after any new row of the target string, the same as each start and end. this is equal to the/m modifier in Perl. if the target string does not contain the "n" character, or the mode does not contain the ^ or $ character, this modifier does not work.
S (PCRE_DOTALL)
If this modifier is set, a "dot" in the mode will match all characters, including line breaks. without him, the line feed will be excluded. this modifier is equivalent to the/s modifier in Perl. the opposite type. For example, [^ a] will always match the line feed character, regardless of the modifier restrictions.
X (PCRE_EXTENDED)
If this modifier is set, all spaces in the mode will be ignored, unless the escape character or internal type of a character is used, the number of unescaped # characters other than the character type is also ignored. this is equivalent to the/x modifier in Perl. In this way, annotations can be added to complicated patterns. note: only applicable to data characters. space characters are not displayed in the specified sequence of pattern characters.
E
If this modifier is set, preg_replace () will be replaced normally in the replacement value.

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.