CVS update: php3/doc/functions

From: Date: Sun, 30 May 1999 16:06:45 +0000
Subject: CVS update: php3/doc/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-6309@lists.php.net to get a copy of this message
Date: Sunday May 30, 1999 @ 12:06 Author: andrey Update of /repository/php3/doc/functions In directory php:/tmp/cvs-serv3806/functions Modified Files: pcre.sgml Log Message: More docs. Index: php3/doc/functions/pcre.sgml diff -u php3/doc/functions/pcre.sgml:1.6 php3/doc/functions/pcre.sgml:1.7 --- php3/doc/functions/pcre.sgml:1.6 Sun May 30 11:04:20 1999 +++ php3/doc/functions/pcre.sgml Sun May 30 12:06:44 1999 @@ -16,18 +16,10 @@ it needs to be escaped by backslash. <para> - The ending delimiter may be followed by various options that affect - the matching. i, m, s, and x options have the same effect as they - do in Perl. There are also some upper case options that Perl doesn't - have. A, E, U, and X set PCRE_ANCHORED, PCRE_DOLLAR_ENDONLY, - PCRE_UNGREEDY, and PCRE_EXTRA respectively. The result of these - options is explained in more detail in PCRE manual. + The ending delimiter may be followed by various options that + affect the matching. + See <link linkend="pattern.options">Pattern Options<link>. - <para> - S option can be specified to make the library analyze the pattern - a bit more carefully. This is mainly useful when many searches using - the same pattern need to be performed, and the pattern is not anchored - and does not have a single fixed starting character. <para> <example> @@ -313,6 +305,155 @@ See also <function>preg_match</function>, <function>preg_match_all</function>, and <function>preg_replace</function>. + </refsect1> + </refentry> + + <refentry id="pattern.options"> + <refnamediv> + <refname>Pattern Options</refname> + <refpurpose>describes possible options in regex + patterns</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <para> + The current possible PCRE options are listed below. The names in + parentheses refer internal PCRE names for these options. + + <para> + <blockquote> + <variablelist> + <varlistentry> + <term><emphasis>i</emphasis> (PCRE_CASELESS)</term> + <listitem> + <simpara> + If this option is set, letters in the pattern match both + upper and lower case letters. + </listitem> + </varlistentry> + + <varlistentry> + <term><emphasis>m</emphasis> (PCRE_MULTILINE)</term> + <listitem> + <simpara> + By default, PCRE treats the subject string as consisting of a + single "line" of characters (even if it actually contains + several newlines). The "start of line" metacharacter (^) + matches only at the start of the string, while the "end of + line" metacharacter ($) matches only at the end of the + string, or before a terminating newline (unless + <emphasis>E</emphasis> option is set). This is the same as + Perl. + + <simpara> + When this option is set, the "start of line" and "end of + line" constructs match immediately following or immediately + before any newline in the subject string, respectively, as + well as at the very start and end. This is equivalent to + Perl's /m option. If there are no "\n" characters in a + subject string, or no occurrences of ^ or $ in a pattern, + setting this option has no effect. + </listitem> + </varlistentry> + + <varlistentry> + <term><emphasis>s</emphasis> (PCRE_DOTALL)</term> + <listitem> + <simpara> + If this option is set, a dot metacharater in the pattern + matches all characters, including newlines. Without it, + newlines are excluded. This option is equivalent to Perl's + /s option. A negative class such as [^a] always matches a + newline character, independent of the setting of this + option. + </listitem> + </varlistentry> + + <varlistentry> + <term><emphasis>x</emphasis> (PCRE_EXTENDED)</term> + <listitem> + <simpara> + If this option is set, whitespace data characters in the + pattern are totally ignored except when escaped or inside a + character class, and characters between an unescaped # + outside a character class and the next newline character, + inclusive, are also ignored. This is equivalent to Perl's /x + option, and makes it possible to include comments inside + complicated patterns. Note, however, that this applies only + to data characters. Whitespace characters may never appear + within special character sequences in a pattern, for example + within the sequence (?( which introduces a conditional + subpattern. + </listitem> + </varlistentry> + + <varlistentry> + <term><emphasis>A</emphasis> (PCRE_ANCHORED)</term> + <listitem> + <simpara> + If this option is set, the pattern is forced to be + "anchored", that is, it is constrained to match only at the + start of the string which is being searched (the "subject + string"). This effect can also be achieved by appropriate + constructs in the pattern itself, which is the only way to + do it in Perl. + </listitem> + </varlistentry> + + <varlistentry> + <term><emphasis>E</emphasis> (PCRE_DOLLAR_ENDONLY)</term> + <listitem> + <simpara> + If this option is set, a dollar metacharacter in the pattern + matches only at the end of the subject string. Without this + option, a dollar also matches immediately before the final + character if it is a newline (but not before any other + newlines). This option is ignored if <emphasis>m</emphasis> + option is set. There is no equivalent to this option in + Perl. + </listitem> + </varlistentry> + + <varlistentry> + <term><emphasis>S</emphasis></term> + <listitem> + <simpara> + When a pattern is going to be used several times, it is + worth spending more time analyzing it in order to speed up + the time taken for matching. If this option is set, then + this extra analysis is performed. At present, studying a + pattern is useful only for non-anchored patterns that do not + have a single fixed starting character. + </listitem> + </varlistentry> + + <varlistentry> + <term><emphasis>U</emphasis> (PCRE_UNGREEDY)</term> + <listitem> + <simpara> + This option inverts the "greediness" of the quantifiers so + that they are not greedy by default, but become greedy if + followed by "?". It is not compatible with Perl. It can also + be set by a (?U) option setting within the pattern. + </listitem> + </varlistentry> + + <varlistentry> + <term><emphasis>X</emphasis> (PCRE_EXTRA)</term> + <listitem> + <simpara> + This option turns on additional functionality of PCRE that + is incompatible with Perl. Any backslash in a pattern that + is followed by a letter that has no special meaning causes + an error, thus reserving these combinations for future + expansion. By default, as in Perl, a backslash followed by a + letter with no special meaning is treated as a literal. + There are at present no other features controlled by this + option. + </listitem> + </varlistentry> + </variablelist> + </blockquote> </refsect1> </refentry> </reference> -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#6309) next »