nlopess Sun Dec 19 08:35:36 2004 EDT
Modified files: /phpdoc/en/reference/pcre pattern.syntax.xml Log: update docs to reflect the new behaviour of (?xx) at top level http://cvs.php.net/diff.php/phpdoc/en/reference/pcre/pattern.syntax.xml?r1=1.5&r2=1.6&ty=u Index: phpdoc/en/reference/pcre/pattern.syntax.xml diff -u phpdoc/en/reference/pcre/pattern.syntax.xml:1.5 phpdoc/en/reference/pcre/pattern.syntax.xml:1.6 --- phpdoc/en/reference/pcre/pattern.syntax.xml:1.5 Mon Dec 6 22:29:16 2004 +++ phpdoc/en/reference/pcre/pattern.syntax.xml Sun Dec 19 08:35:34 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.5 $ --> +<!-- $Revision: 1.6 $ --> <!-- splitted from ./en/functions/pcre.xml, last change in rev 1.2 --> <refentry id="reference.pcre.pattern.syntax"> <refnamediv> @@ -802,33 +802,22 @@ For example, (?im) sets caseless, multiline matching. It is also possible to unset these options by preceding the letter with a hyphen, and a combined setting and unsetting such as - (?im-sx), which sets <link linkend="reference.pcre.pattern.modifiers">PCRE_CASELESS</link> and <link linkend="reference.pcre.pattern.modifiers">PCRE_MULTILINE</link> while - unsetting <link linkend="reference.pcre.pattern.modifiers">PCRE_DOTALL</link> and <link linkend="reference.pcre.pattern.modifiers">PCRE_EXTENDED</link>, is also permitted. - If a letter appears both before and after the hyphen, the - option is unset. - </para> - <para> - The scope of these option changes depends on where in the - pattern the setting occurs. For settings that are outside - any subpattern (defined below), the effect is the same as if - the options were set or unset at the start of matching. The - following patterns all behave in exactly the same way: - </para> - - <literallayout> - (?i)abc - a(?i)bc - ab(?i)c - abc(?i) - </literallayout> - - <para> - which in turn is the same as compiling the pattern abc with - <link linkend="reference.pcre.pattern.modifiers">PCRE_CASELESS</link> set. - In other words, such "top level" settings apply to the whole - pattern (unless there are other changes inside subpatterns). - If there is more than one setting of the same option at top level, - the rightmost setting is used. + (?im-sx), which sets <link + linkend="reference.pcre.pattern.modifiers">PCRE_CASELESS</link> and + <link linkend="reference.pcre.pattern.modifiers">PCRE_MULTILINE</link> + while unsetting <link + linkend="reference.pcre.pattern.modifiers">PCRE_DOTALL</link> and + <link linkend="reference.pcre.pattern.modifiers">PCRE_EXTENDED</link>, + is also permitted. If a letter appears both before and after the + hyphen, the option is unset. + </para> + <para> + When an option change occurs at top level (that is, not inside + subpattern parentheses), the change applies to the remainder of the + pattern that follows. So <literal>/ab(?i)c/</literal> matches only "abc" + and "abC". This behaviour has been changed in PCRE 4.0, which is bundled + since PHP 4.3.3. Before those versions, <literal>/ab(?i)c/</literal> would + perform as <literal>/abc/i</literal> (e.g. matching "ABC" and "aBc"). </para> <para> If an option change occurs inside a subpattern, the effect @@ -838,11 +827,11 @@ <literal>(a(?i)b)c</literal> - matches abc and aBc and no other strings (assuming - <link linkend="reference.pcre.pattern.modifiers">PCRE_CASELESS</link> is not used). By this means, options can be - made to have different settings in different parts of the - pattern. Any changes made in one alternative do carry on - into subsequent branches within the same subpattern. For + matches abc and aBc and no other strings (assuming <link + linkend="reference.pcre.pattern.modifiers">PCRE_CASELESS</link> is not + used). By this means, options can be made to have different settings in + different parts of the pattern. Any changes made in one alternative do + carry on into subsequent branches within the same subpattern. For example, <literal>(a(?i)b|c)</literal>