PHP Regular Expression/I,/is,/s,/isu etc introduction _php Tips

Source: Internet
Author: User
Tags modifier php regular expression

PHP Regular Expression I/I,/is,/s,/isu, etc. what are these things?

I do not case sensitive

The dot meta character (.) in S mode matches all characters, including line breaks

whitespace characters in x mode are completely ignored in addition to being escaped or outside of the character class, and all characters, including both ends, that are not escaped from the character class and the next line break are ignored

A (pcre_anchored) if this modifier is set, the pattern is coerced to "anchored", that is, forcing only the start of a match from the beginning of the target string is automatically added ^ at the beginning of the pattern.

D (pcre_dollar_endonly) If this modifier is set, the dollar character in the pattern matches only the end of the target string. Without this option, if the last character is a newline, the dollar sign also matches the character before it (but does not match any other line breaks). This option is ignored if the M modifier is set. There is no equivalent modifier in Perl. S when a pattern is used several times, it is worthwhile to analyze it for the sake of accelerated matching. If this modifier is set, an additional analysis is performed. Currently, parsing a pattern is only useful for non-anchored patterns that do not have a single fixed starting character.

U (pcre_ungreedy) This modifier reverses the matching number of values so that it is not the default repetition, and becomes followed by the "?" to become repetitive. This is not compatible with Perl. It can also be set in the pattern (? U) modifier to enable this option.

X (Pcre_extra) This modifier enables an additional feature that is incompatible with Perl in a PCRE. Any backslash in the pattern followed by a letter with no special meaning causes an error, thus preserving this combination for future expansion. By default, as with Perl, a backslash is followed by a letter that has no special meaning. No other features are currently controlled by this modifier. That is: Greedy mode, maximum matching, such as:/a[\w]+?e/u matching abceadeddd in the abceade instead of ABCE, if you do not add a correction, then match ABCE u (PCRE_UTF8) This modifier enables an additional feature that is incompatible with Perl in PCRE. The pattern string is treated as UTF-8. This modifier is available under Unix from PHP 4.1.0 and is available under Win32 from PHP 4.2.3.

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.