PHP Regular Expressions/I,/is,/s,/isu, etc., regular expressions isu_php tutorials

Source: Internet
Author: User
Tags php regular expression

PHP Regular Expressions/I,/is,/s,/isu, etc., regular expressions ISU


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

I is case insensitive

Dot metacharacters (.) in S-mode match all characters, including line break

whitespace characters in the X-mode are ignored except for escaped or are completely ignored outside of the character class, and all characters between # and the next newline character outside the non-escaped characters class, including both ends, are also omitted

A (pcre_anchored) if this modifier is set, the pattern is coerced to "anchored", that is, forcing the match to start only from the beginning of the target string and automatically adds ^ 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 line break, the dollar sign will also match this character before (but not before any other line break). This option is ignored if the M modifier is set. There is no equivalent modifier in Perl. S when a pattern is to be used several times, it is worth analyzing it to speed up the match. If this modifier is set, 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 value of the matched quantity so that it is not the default repetition, and becomes followed by "?". only to become repetitive. This is not compatible with Perl. You can also set the (? 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, preserving this combination for future expansion. By default, as with Perl, a backslash followed by a letter with no special meaning is treated as the letter itself. No other feature is currently controlled by this modifier. That is: Greedy mode, the maximum match, such as:/a[\w]+?e/u match abceadeddd in Abceade instead of ABCE, if not plus u correction, then the match ABCE u (PCRE_UTF8) This modifier enables a PCRE in an additional feature that is incompatible with Perl. 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.


PHP Regular expression problem:/<[^>]*?>*?<\/>/si This is an expression that filters all scripts can be explained in detail?

Plus "?" Represents a non-greedy match ...

Parameter ' i ' means ignoring case

The parameter "s" means "." In the regular. Can match line breaks

PHP regular matches/href=\ ' ([\s\s]*) \ '/isu

Preg_match ("/href=\" ([\s\s]*) \ '/", $str, $match); Echo $match [1]; This is a match inside the parentheses.

http://www.bkjia.com/PHPjc/898282.html www.bkjia.com true http://www.bkjia.com/PHPjc/898282.html techarticle PHP Regular Expressions/I,/is,/S,/isu, and so on, regular expressions ISU php Regular Expressions/I,/is,/s,/isu, etc. what are these things? I do not differentiate between the dot characters in the case of S-mode ...

  • Related Article

    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.