Pcre_caseless, Pcre_multiline, Pcre_dotall, Pcre_ungreedy,pcre_extra, pcre_extended and PCRE_DUPNAMES The pattern modifier settings can be set within the pattern by a sequence of Perl option characters, with the following syntax: (? modifier), the available modifiers are:
Internal option Letters
I for Pcre_caseless
M for Pcre_multiline
S for Pcre_dotall
X for pcre_extended
U for Pcre_ungreedy
X for Pcre_extra
J for Pcre_info_jchanged
For example, the (? IM) setting indicates a multiple-line case-insensitive match. You can also use it to cancel these settings, such as (? im-sx) Setting the Pcre_caseless,pcre_multiline, but cancel both Pcre_dotall and pcre_extended. This option is deselected if a letter appears before-and also appears in-after.
This change affects the rest of the pattern when an option is in the most superior of the pattern (that is, not in the subgroup). For example,/ab (? i) c/only matches "ABC" and "ABC". This form is changed in PCRE 4.0 (PHP 4.3.3). In previous versions, the/ab (? i) c/behavior was exactly the same as the/abc/i.
If an option is set in a subgroup, the effect is different. This is a variant of the behavior in Perl 5.005. An option is set inside a subgroup, changing only the remaining portions of the subgroup, so (a (? i) b) C matches only "ABC" and "ABC" (assuming that the pcre_caseless option is not used). This means that options can have different effects in different locations of the pattern. In the same child mode, the option settings for a branch go back through the remaining branches that follow. For example (a (? i) b|c) matches "AB", "AB", "C" and "C". Although the first branch will be discarded before the option is set when matching "C". This is because the setting of the option is determined at compile time, otherwise it can lead to very bizarre behavior.
PCRE dedicated options Pcre_ungreedy and Pcre_extra can be changed in the same way as Perl compatibility options, using the letters U and X respectively. X) tag settings are special, it must appear before any other features, preferably at the beginning of the position.