httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pgollu...@apache.org
Subject svn commit: r598343 [15/22] - in /httpd/httpd/vendor/pcre/current: ./ doc/ doc/html/ testdata/
Date Mon, 26 Nov 2007 17:04:37 GMT
Modified: httpd/httpd/vendor/pcre/current/doc/pcrepattern.3
URL: http://svn.apache.org/viewvc/httpd/httpd/vendor/pcre/current/doc/pcrepattern.3?rev=598343&r1=598342&r2=598343&view=diff
==============================================================================
--- httpd/httpd/vendor/pcre/current/doc/pcrepattern.3 (original)
+++ httpd/httpd/vendor/pcre/current/doc/pcrepattern.3 Mon Nov 26 09:04:19 2007
@@ -1,19 +1,15 @@
-.TH PCREPATTERN 3
+.TH PCRE 3
 .SH NAME
 PCRE - Perl-compatible regular expressions
 .SH "PCRE REGULAR EXPRESSION DETAILS"
 .rs
 .sp
-The syntax and semantics of the regular expressions that are supported by PCRE
-are described in detail below. There is a quick-reference syntax summary in the
-.\" HREF
-\fBpcresyntax\fP
-.\"
-page. Perl's regular expressions are described in its own documentation, and
-regular expressions in general are covered in a number of books, some of which
-have copious examples. Jeffrey Friedl's "Mastering Regular Expressions",
-published by O'Reilly, covers regular expressions in great detail. This
-description of PCRE's regular expressions is intended as reference material.
+The syntax and semantics of the regular expressions supported by PCRE are
+described below. Regular expressions are also described in the Perl
+documentation and in a number of books, some of which have copious examples.
+Jeffrey Friedl's "Mastering Regular Expressions", published by O'Reilly, covers
+regular expressions in great detail. This description of PCRE's regular
+expressions is intended as reference material.
 .P
 The original operation of PCRE was on strings of one-byte characters. However,
 there is now also support for UTF-8 character strings. To use this, you must
@@ -30,97 +26,22 @@
 .\"
 page.
 .P
-The remainder of this document discusses the patterns that are supported by
-PCRE when its main matching function, \fBpcre_exec()\fP, is used.
-From release 6.0, PCRE offers a second matching function,
-\fBpcre_dfa_exec()\fP, which matches using a different algorithm that is not
-Perl-compatible. Some of the features discussed below are not available when
-\fBpcre_dfa_exec()\fP is used. The advantages and disadvantages of the
-alternative function, and how it differs from the normal function, are
-discussed in the
-.\" HREF
-\fBpcrematching\fP
-.\"
-page.
-.
-.
-.SH "NEWLINE CONVENTIONS"
-.rs
-.sp
-PCRE supports five different conventions for indicating line breaks in
-strings: a single CR (carriage return) character, a single LF (linefeed)
-character, the two-character sequence CRLF, any of the three preceding, or any
-Unicode newline sequence. The
-.\" HREF
-\fBpcreapi\fP
-.\"
-page has
-.\" HTML <a href="pcreapi.html#newlines">
-.\" </a>
-further discussion
-.\"
-about newlines, and shows how to set the newline convention in the
-\fIoptions\fP arguments for the compiling and matching functions.
-.P
-It is also possible to specify a newline convention by starting a pattern
-string with one of the following five sequences:
-.sp
-  (*CR)        carriage return
-  (*LF)        linefeed
-  (*CRLF)      carriage return, followed by linefeed
-  (*ANYCRLF)   any of the three above
-  (*ANY)       all Unicode newline sequences
-.sp
-These override the default and the options given to \fBpcre_compile()\fP. For
-example, on a Unix system where LF is the default newline sequence, the pattern
-.sp
-  (*CR)a.b
-.sp
-changes the convention to CR. That pattern matches "a\enb" because LF is no
-longer a newline. Note that these special settings, which are not
-Perl-compatible, are recognized only at the very start of a pattern, and that
-they must be in upper case. If more than one of them is present, the last one
-is used.
-.P
-The newline convention does not affect what the \eR escape sequence matches. By
-default, this is any Unicode newline sequence, for Perl compatibility. However,
-this can be changed; see the description of \eR in the section entitled
-.\" HTML <a href="#newlineseq">
-.\" </a>
-"Newline sequences"
-.\"
-below. A change of \eR setting can be combined with a change of newline
-convention.
-.
-.
-.SH "CHARACTERS AND METACHARACTERS"
-.rs
-.sp
 A regular expression is a pattern that is matched against a subject string from
 left to right. Most characters stand for themselves in a pattern, and match the
 corresponding characters in the subject. As a trivial example, the pattern
 .sp
   The quick brown fox
 .sp
-matches a portion of a subject string that is identical to itself. When
-caseless matching is specified (the PCRE_CASELESS option), letters are matched
-independently of case. In UTF-8 mode, PCRE always understands the concept of
-case for characters whose values are less than 128, so caseless matching is
-always possible. For characters with higher values, the concept of case is
-supported if PCRE is compiled with Unicode property support, but not otherwise.
-If you want to use caseless matching for characters 128 and above, you must
-ensure that PCRE is compiled with Unicode property support as well as with
-UTF-8 support.
-.P
-The power of regular expressions comes from the ability to include alternatives
-and repetitions in the pattern. These are encoded in the pattern by the use of
+matches a portion of a subject string that is identical to itself. The power of
+regular expressions comes from the ability to include alternatives and
+repetitions in the pattern. These are encoded in the pattern by the use of
 \fImetacharacters\fP, which do not stand for themselves but instead are
 interpreted in some special way.
 .P
 There are two different sets of metacharacters: those that are recognized
 anywhere in the pattern except within square brackets, and those that are
-recognized within square brackets. Outside square brackets, the metacharacters
-are as follows:
+recognized in square brackets. Outside square brackets, the metacharacters are
+as follows:
 .sp
   \e      general escape character with several uses
   ^      assert start of string (or line, in multiline mode)
@@ -151,13 +72,12 @@
 .sp
 The following sections describe the use of each of the metacharacters.
 .
-.
 .SH BACKSLASH
 .rs
 .sp
 The backslash character has several uses. Firstly, if it is followed by a
-non-alphanumeric character, it takes away any special meaning that character
-may have. This use of backslash as an escape character applies both inside and
+non-alphanumeric character, it takes away any special meaning that character may
+have. This use of backslash as an escape character applies both inside and
 outside character classes.
 .P
 For example, if you want to match a * character, you write \e* in the pattern.
@@ -168,8 +88,9 @@
 .P
 If a pattern is compiled with the PCRE_EXTENDED option, whitespace in the
 pattern (other than in a character class) and characters between a # outside
-a character class and the next newline are ignored. An escaping backslash can
-be used to include a whitespace or # character as part of the pattern.
+a character class and the next newline character are ignored. An escaping
+backslash can be used to include a whitespace or # character as part of the
+pattern.
 .P
 If you want to remove the special meaning from a sequence of characters, you
 can do so by putting them between \eQ and \eE. This is different from Perl in
@@ -202,12 +123,12 @@
   \ecx       "control-x", where x is any character
   \ee        escape (hex 1B)
   \ef        formfeed (hex 0C)
-  \en        linefeed (hex 0A)
+  \en        newline (hex 0A)
   \er        carriage return (hex 0D)
   \et        tab (hex 09)
   \eddd      character with octal code ddd, or backreference
   \exhh      character with hex code hh
-  \ex{hhh..} character with hex code hhh..
+  \ex{hhh..} character with hex code hhh... (UTF-8 mode only)
 .sp
 The precise effect of \ecx is as follows: if x is a lower case letter, it
 is converted to upper case. Then bit 6 of the character (hex 40) is inverted.
@@ -215,26 +136,23 @@
 7B.
 .P
 After \ex, from zero to two hexadecimal digits are read (letters can be in
-upper or lower case). Any number of hexadecimal digits may appear between \ex{
-and }, but the value of the character code must be less than 256 in non-UTF-8
-mode, and less than 2**31 in UTF-8 mode. That is, the maximum value in
-hexadecimal is 7FFFFFFF. Note that this is bigger than the largest Unicode code
-point, which is 10FFFF.
-.P
-If characters other than hexadecimal digits appear between \ex{ and }, or if
-there is no terminating }, this form of escape is not recognized. Instead, the
-initial \ex will be interpreted as a basic hexadecimal escape, with no
-following digits, giving a character whose value is zero.
+upper or lower case). In UTF-8 mode, any number of hexadecimal digits may
+appear between \ex{ and }, but the value of the character code must be less
+than 2**31 (that is, the maximum hexadecimal value is 7FFFFFFF). If characters
+other than hexadecimal digits appear between \ex{ and }, or if there is no
+terminating }, this form of escape is not recognized. Instead, the initial
+\ex will be interpreted as a basic hexadecimal escape, with no following
+digits, giving a character whose value is zero.
 .P
 Characters whose value is less than 256 can be defined by either of the two
-syntaxes for \ex. There is no difference in the way they are handled. For
-example, \exdc is exactly the same as \ex{dc}.
+syntaxes for \ex when PCRE is in UTF-8 mode. There is no difference in the
+way they are handled. For example, \exdc is exactly the same as \ex{dc}.
 .P
-After \e0 up to two further octal digits are read. If there are fewer than two
-digits, just those that are present are used. Thus the sequence \e0\ex\e07
-specifies two binary zeros followed by a BEL character (code value 7). Make
-sure you supply two digits after the initial zero if the pattern character that
-follows is itself an octal digit.
+After \e0 up to two further octal digits are read. In both cases, if there
+are fewer than two digits, just those that are present are used. Thus the
+sequence \e0\ex\e07 specifies two binary zeros followed by a BEL character
+(code value 7). Make sure you supply two digits after the initial zero if the
+pattern character that follows is itself an octal digit.
 .P
 The handling of a backslash followed by a digit other than 0 is complicated.
 Outside a character class, PCRE reads it and any following digits as a decimal
@@ -253,10 +171,9 @@
 .P
 Inside a character class, or if the decimal number is greater than 9 and there
 have not been that many capturing subpatterns, PCRE re-reads up to three octal
-digits following the backslash, and uses them to generate a data character. Any
-subsequent digits stand for themselves. In non-UTF-8 mode, the value of a
-character specified in octal must be less than \e400. In UTF-8 mode, values up
-to \e777 are permitted. For example:
+digits following the backslash, and generates a single byte from the least
+significant 8 bits of the value. Any subsequent digits stand for themselves.
+For example:
 .sp
   \e040   is another way of writing a space
 .\" JOIN
@@ -281,11 +198,11 @@
 Note that octal values of 100 or greater must not be introduced by a leading
 zero, because no more than three octal digits are ever read.
 .P
-All the sequences that define a single character value can be used both inside
-and outside character classes. In addition, inside a character class, the
-sequence \eb is interpreted as the backspace character (hex 08), and the
-sequences \eR and \eX are interpreted as the characters "R" and "X",
-respectively. Outside a character class, these sequences have different
+All the sequences that define a single byte value or a single UTF-8 character
+(in UTF-8 mode) can be used both inside and outside character classes. In
+addition, inside a character class, the sequence \eb is interpreted as the
+backspace character (hex 08), and the sequence \eX is interpreted as the
+character "X". Outside a character class, these sequences have different
 meanings
 .\" HTML <a href="#uniextseq">
 .\" </a>
@@ -293,37 +210,16 @@
 .\"
 .
 .
-.SS "Absolute and relative back references"
-.rs
-.sp
-The sequence \eg followed by an unsigned or a negative number, optionally
-enclosed in braces, is an absolute or relative back reference. A named back
-reference can be coded as \eg{name}. Back references are discussed
-.\" HTML <a href="#backreferences">
-.\" </a>
-later,
-.\"
-following the discussion of
-.\" HTML <a href="#subpattern">
-.\" </a>
-parenthesized subpatterns.
-.\"
-.
-.
 .SS "Generic character types"
 .rs
 .sp
-Another use of backslash is for specifying generic character types. The
+The third use of backslash is for specifying generic character types. The
 following are always recognized:
 .sp
   \ed     any decimal digit
   \eD     any character that is not a decimal digit
-  \eh     any horizontal whitespace character
-  \eH     any character that is not a horizontal whitespace character
   \es     any whitespace character
   \eS     any character that is not a whitespace character
-  \ev     any vertical whitespace character
-  \eV     any character that is not a vertical whitespace character
   \ew     any "word" character
   \eW     any "non-word" character
 .sp
@@ -337,49 +233,7 @@
 .P
 For compatibility with Perl, \es does not match the VT character (code 11).
 This makes it different from the the POSIX "space" class. The \es characters
-are HT (9), LF (10), FF (12), CR (13), and space (32). If "use locale;" is
-included in a Perl script, \es may match the VT character. In PCRE, it never
-does.
-.P
-In UTF-8 mode, characters with values greater than 128 never match \ed, \es, or
-\ew, and always match \eD, \eS, and \eW. This is true even when Unicode
-character property support is available. These sequences retain their original
-meanings from before UTF-8 support was available, mainly for efficiency
-reasons.
-.P
-The sequences \eh, \eH, \ev, and \eV are Perl 5.10 features. In contrast to the
-other sequences, these do match certain high-valued codepoints in UTF-8 mode.
-The horizontal space characters are:
-.sp
-  U+0009     Horizontal tab
-  U+0020     Space
-  U+00A0     Non-break space
-  U+1680     Ogham space mark
-  U+180E     Mongolian vowel separator
-  U+2000     En quad
-  U+2001     Em quad
-  U+2002     En space
-  U+2003     Em space
-  U+2004     Three-per-em space
-  U+2005     Four-per-em space
-  U+2006     Six-per-em space
-  U+2007     Figure space
-  U+2008     Punctuation space
-  U+2009     Thin space
-  U+200A     Hair space
-  U+202F     Narrow no-break space
-  U+205F     Medium mathematical space
-  U+3000     Ideographic space
-.sp
-The vertical space characters are:
-.sp
-  U+000A     Linefeed
-  U+000B     Vertical tab
-  U+000C     Formfeed
-  U+000D     Carriage return
-  U+0085     Next line
-  U+2028     Line separator
-  U+2029     Paragraph separator
+are HT (9), LF (10), FF (12), CR (13), and space (32).
 .P
 A "word" character is an underscore or any character less than 256 that is a
 letter or digit. The definition of letters and digits is controlled by PCRE's
@@ -393,59 +247,12 @@
 .\" HREF
 \fBpcreapi\fP
 .\"
-page). For example, in a French locale such as "fr_FR" in Unix-like systems,
-or "french" in Windows, some character codes greater than 128 are used for
-accented letters, and these are matched by \ew. The use of locales with Unicode
-is discouraged.
-.
-.
-.\" HTML <a name="newlineseq"></a>
-.SS "Newline sequences"
-.rs
-.sp
-Outside a character class, by default, the escape sequence \eR matches any
-Unicode newline sequence. This is a Perl 5.10 feature. In non-UTF-8 mode \eR is
-equivalent to the following:
-.sp
-  (?>\er\en|\en|\ex0b|\ef|\er|\ex85)
-.sp
-This is an example of an "atomic group", details of which are given
-.\" HTML <a href="#atomicgroup">
-.\" </a>
-below.
-.\"
-This particular group matches either the two-character sequence CR followed by
-LF, or one of the single characters LF (linefeed, U+000A), VT (vertical tab,
-U+000B), FF (formfeed, U+000C), CR (carriage return, U+000D), or NEL (next
-line, U+0085). The two-character sequence is treated as a single unit that
-cannot be split.
-.P
-In UTF-8 mode, two additional characters whose codepoints are greater than 255
-are added: LS (line separator, U+2028) and PS (paragraph separator, U+2029).
-Unicode character property support is not needed for these characters to be
-recognized.
-.P
-It is possible to restrict \eR to match only CR, LF, or CRLF (instead of the
-complete set of Unicode line endings) by setting the option PCRE_BSR_ANYCRLF
-either at compile time or when the pattern is matched. (BSR is an abbrevation
-for "backslash R".) This can be made the default when PCRE is built; if this is
-the case, the other behaviour can be requested via the PCRE_BSR_UNICODE option.
-It is also possible to specify these settings by starting a pattern string with
-one of the following sequences:
-.sp
-  (*BSR_ANYCRLF)   CR, LF, or CRLF only
-  (*BSR_UNICODE)   any Unicode newline sequence
-.sp
-These override the default and the options given to \fBpcre_compile()\fP, but
-they can be overridden by options given to \fBpcre_exec()\fP. Note that these
-special settings, which are not Perl-compatible, are recognized only at the
-very start of a pattern, and that they must be in upper case. If more than one
-of them is present, the last one is used. They can be combined with a change of
-newline convention, for example, a pattern can start with:
-.sp
-  (*ANY)(*BSR_ANYCRLF)
-.sp
-Inside a character class, \eR matches the letter "R".
+page). For example, in the "fr_FR" (French) locale, some character codes
+greater than 128 are used for accented letters, and these are matched by \ew.
+.P
+In UTF-8 mode, characters with values greater than 128 never match \ed, \es, or
+\ew, and always match \eD, \eS, and \eW. This is true even when Unicode
+character property support is available.
 .
 .
 .\" HTML <a name="uniextseq"></a>
@@ -453,112 +260,28 @@
 .rs
 .sp
 When PCRE is built with Unicode character property support, three additional
-escape sequences that match characters with specific properties are available.
-When not in UTF-8 mode, these sequences are of course limited to testing
-characters whose codepoints are less than 256, but they do work in this mode.
-The extra escape sequences are:
-.sp
-  \ep{\fIxx\fP}   a character with the \fIxx\fP property
-  \eP{\fIxx\fP}   a character without the \fIxx\fP property
-  \eX       an extended Unicode sequence
-.sp
-The property names represented by \fIxx\fP above are limited to the Unicode
-script names, the general category properties, and "Any", which matches any
-character (including newline). Other properties such as "InMusicalSymbols" are
-not currently supported by PCRE. Note that \eP{Any} does not match any
-characters, so always causes a match failure.
-.P
-Sets of Unicode characters are defined as belonging to certain scripts. A
-character from one of these sets can be matched using a script name. For
-example:
-.sp
-  \ep{Greek}
-  \eP{Han}
-.sp
-Those that are not part of an identified script are lumped together as
-"Common". The current list of scripts is:
-.P
-Arabic,
-Armenian,
-Balinese,
-Bengali,
-Bopomofo,
-Braille,
-Buginese,
-Buhid,
-Canadian_Aboriginal,
-Cherokee,
-Common,
-Coptic,
-Cuneiform,
-Cypriot,
-Cyrillic,
-Deseret,
-Devanagari,
-Ethiopic,
-Georgian,
-Glagolitic,
-Gothic,
-Greek,
-Gujarati,
-Gurmukhi,
-Han,
-Hangul,
-Hanunoo,
-Hebrew,
-Hiragana,
-Inherited,
-Kannada,
-Katakana,
-Kharoshthi,
-Khmer,
-Lao,
-Latin,
-Limbu,
-Linear_B,
-Malayalam,
-Mongolian,
-Myanmar,
-New_Tai_Lue,
-Nko,
-Ogham,
-Old_Italic,
-Old_Persian,
-Oriya,
-Osmanya,
-Phags_Pa,
-Phoenician,
-Runic,
-Shavian,
-Sinhala,
-Syloti_Nagri,
-Syriac,
-Tagalog,
-Tagbanwa,
-Tai_Le,
-Tamil,
-Telugu,
-Thaana,
-Thai,
-Tibetan,
-Tifinagh,
-Ugaritic,
-Yi.
-.P
-Each character has exactly one general category property, specified by a
-two-letter abbreviation. For compatibility with Perl, negation can be specified
-by including a circumflex between the opening brace and the property name. For
-example, \ep{^Lu} is the same as \eP{Lu}.
-.P
-If only one letter is specified with \ep or \eP, it includes all the general
-category properties that start with that letter. In this case, in the absence
-of negation, the curly brackets in the escape sequence are optional; these two
-examples have the same effect:
+escape sequences to match generic character types are available when UTF-8 mode
+is selected. They are:
+.sp
+ \ep{\fIxx\fP}   a character with the \fIxx\fP property
+ \eP{\fIxx\fP}   a character without the \fIxx\fP property
+ \eX       an extended Unicode sequence
+.sp
+The property names represented by \fIxx\fP above are limited to the
+Unicode general category properties. Each character has exactly one such
+property, specified by a two-letter abbreviation. For compatibility with Perl,
+negation can be specified by including a circumflex between the opening brace
+and the property name. For example, \ep{^Lu} is the same as \eP{Lu}.
+.P
+If only one letter is specified with \ep or \eP, it includes all the properties
+that start with that letter. In this case, in the absence of negation, the
+curly brackets in the escape sequence are optional; these two examples have
+the same effect:
 .sp
   \ep{L}
   \epL
 .sp
-The following general category property codes are supported:
+The following property codes are supported:
 .sp
   C     Other
   Cc    Control
@@ -604,26 +327,8 @@
   Zp    Paragraph separator
   Zs    Space separator
 .sp
-The special property L& is also supported: it matches a character that has
-the Lu, Ll, or Lt property, in other words, a letter that is not classified as
-a modifier or "other".
-.P
-The Cs (Surrogate) property applies only to characters in the range U+D800 to
-U+DFFF. Such characters are not valid in UTF-8 strings (see RFC 3629) and so
-cannot be tested by PCRE, unless UTF-8 validity checking has been turned off
-(see the discussion of PCRE_NO_UTF8_CHECK in the
-.\" HREF
-\fBpcreapi\fP
-.\"
-page).
-.P
-The long synonyms for these properties that Perl supports (such as \ep{Letter})
-are not supported by PCRE, nor is it permitted to prefix any of these
-properties with "Is".
-.P
-No character that is in the Unicode table has the Cn (unassigned) property.
-Instead, this property is assumed for any code point that is not in the
-Unicode table.
+Extended properties such as "Greek" or "InMusicalSymbols" are not supported by
+PCRE.
 .P
 Specifying caseless matching does not affect these escape sequences. For
 example, \ep{Lu} always matches only upper case letters.
@@ -641,8 +346,7 @@
 (see below).
 .\"
 Characters with the "mark" property are typically accents that affect the
-preceding character. None of them have codepoints less than 256, so in
-non-UTF-8 mode \eX matches any one character.
+preceding character.
 .P
 Matching characters by Unicode property is not fast, because PCRE has to search
 a structure that contains data for over fifteen thousand characters. That is
@@ -650,41 +354,11 @@
 properties in PCRE.
 .
 .
-.\" HTML <a name="resetmatchstart"></a>
-.SS "Resetting the match start"
-.rs
-.sp
-The escape sequence \eK, which is a Perl 5.10 feature, causes any previously
-matched characters not to be included in the final matched sequence. For
-example, the pattern:
-.sp
-  foo\eKbar
-.sp
-matches "foobar", but reports that it has matched "bar". This feature is
-similar to a lookbehind assertion
-.\" HTML <a href="#lookbehind">
-.\" </a>
-(described below).
-.\"
-However, in this case, the part of the subject before the real match does not
-have to be of fixed length, as lookbehind assertions do. The use of \eK does
-not interfere with the setting of
-.\" HTML <a href="#subpattern">
-.\" </a>
-captured substrings.
-.\"
-For example, when the pattern
-.sp
-  (foo)\eKbar
-.sp
-matches "foobar", the first substring is still set to "foo".
-.
-.
 .\" HTML <a name="smallassertions"></a>
 .SS "Simple assertions"
 .rs
 .sp
-The final use of backslash is for certain simple assertions. An assertion
+The fourth use of backslash is for certain simple assertions. An assertion
 specifies a condition that has to be met at a particular point in a match,
 without consuming any characters from the subject string. The use of
 subpatterns for more complicated assertions is described
@@ -692,15 +366,15 @@
 .\" </a>
 below.
 .\"
-The backslashed assertions are:
+The backslashed
+assertions are:
 .sp
   \eb     matches at a word boundary
   \eB     matches when not at a word boundary
-  \eA     matches at the start of the subject
-  \eZ     matches at the end of the subject
-          also matches before a newline at the end of the subject
-  \ez     matches only at the end of the subject
-  \eG     matches at the first matching position in the subject
+  \eA     matches at start of subject
+  \eZ     matches at end of subject or before newline at end
+  \ez     matches at end of subject
+  \eG     matches at first matching position in subject
 .sp
 These assertions may not appear in character classes (but note that \eb has a
 different meaning, namely the backspace character, inside a character class).
@@ -718,8 +392,9 @@
 circumflex and dollar metacharacters. However, if the \fIstartoffset\fP
 argument of \fBpcre_exec()\fP is non-zero, indicating that matching is to start
 at a point other than the beginning of the subject, \eA can never match. The
-difference between \eZ and \ez is that \eZ matches before a newline at the end
-of the string as well as at the very end, whereas \ez matches only at the end.
+difference between \eZ and \ez is that \eZ matches before a newline that is the
+last character of the string as well as at the end of the string, whereas \ez
+matches only at the end.
 .P
 The \eG assertion is true only when the current matching position is at the
 start point of the match, as specified by the \fIstartoffset\fP argument of
@@ -763,68 +438,53 @@
 .P
 A dollar character is an assertion that is true only if the current matching
 point is at the end of the subject string, or immediately before a newline
-at the end of the string (by default). Dollar need not be the last character of
-the pattern if a number of alternatives are involved, but it should be the last
-item in any branch in which it appears. Dollar has no special meaning in a
-character class.
+character that is the last character in the string (by default). Dollar need
+not be the last character of the pattern if a number of alternatives are
+involved, but it should be the last item in any branch in which it appears.
+Dollar has no special meaning in a character class.
 .P
 The meaning of dollar can be changed so that it matches only at the very end of
 the string, by setting the PCRE_DOLLAR_ENDONLY option at compile time. This
 does not affect the \eZ assertion.
 .P
 The meanings of the circumflex and dollar characters are changed if the
-PCRE_MULTILINE option is set. When this is the case, a circumflex matches
-immediately after internal newlines as well as at the start of the subject
-string. It does not match after a newline that ends the string. A dollar
-matches before any newlines in the string, as well as at the very end, when
-PCRE_MULTILINE is set. When newline is specified as the two-character
-sequence CRLF, isolated CR and LF characters do not indicate newlines.
-.P
-For example, the pattern /^abc$/ matches the subject string "def\enabc" (where
-\en represents a newline) in multiline mode, but not otherwise. Consequently,
-patterns that are anchored in single line mode because all branches start with
-^ are not anchored in multiline mode, and a match for circumflex is possible
-when the \fIstartoffset\fP argument of \fBpcre_exec()\fP is non-zero. The
-PCRE_DOLLAR_ENDONLY option is ignored if PCRE_MULTILINE is set.
+PCRE_MULTILINE option is set. When this is the case, they match immediately
+after and immediately before an internal newline character, respectively, in
+addition to matching at the start and end of the subject string. For example,
+the pattern /^abc$/ matches the subject string "def\enabc" (where \en
+represents a newline character) in multiline mode, but not otherwise.
+Consequently, patterns that are anchored in single line mode because all
+branches start with ^ are not anchored in multiline mode, and a match for
+circumflex is possible when the \fIstartoffset\fP argument of \fBpcre_exec()\fP
+is non-zero. The PCRE_DOLLAR_ENDONLY option is ignored if PCRE_MULTILINE is
+set.
 .P
 Note that the sequences \eA, \eZ, and \ez can be used to match the start and
 end of the subject in both modes, and if all branches of a pattern start with
-\eA it is always anchored, whether or not PCRE_MULTILINE is set.
+\eA it is always anchored, whether PCRE_MULTILINE is set or not.
 .
 .
 .SH "FULL STOP (PERIOD, DOT)"
 .rs
 .sp
 Outside a character class, a dot in the pattern matches any one character in
-the subject string except (by default) a character that signifies the end of a
-line. In UTF-8 mode, the matched character may be more than one byte long.
-.P
-When a line ending is defined as a single character, dot never matches that
-character; when the two-character sequence CRLF is used, dot does not match CR
-if it is immediately followed by LF, but otherwise it matches all characters
-(including isolated CRs and LFs). When any Unicode line endings are being
-recognized, dot does not match CR or LF or any of the other line ending
-characters.
-.P
-The behaviour of dot with regard to newlines can be changed. If the PCRE_DOTALL
-option is set, a dot matches any one character, without exception. If the
-two-character sequence CRLF is present in the subject string, it takes two dots
-to match it.
-.P
-The handling of dot is entirely independent of the handling of circumflex and
-dollar, the only relationship being that they both involve newlines. Dot has no
-special meaning in a character class.
+the subject, including a non-printing character, but not (by default) newline.
+In UTF-8 mode, a dot matches any UTF-8 character, which might be more than one
+byte long, except (by default) newline. If the PCRE_DOTALL option is set,
+dots match newlines as well. The handling of dot is entirely independent of the
+handling of circumflex and dollar, the only relationship being that they both
+involve newline characters. Dot has no special meaning in a character class.
 .
 .
 .SH "MATCHING A SINGLE BYTE"
 .rs
 .sp
 Outside a character class, the escape sequence \eC matches any one byte, both
-in and out of UTF-8 mode. Unlike a dot, it always matches any line-ending
-characters. The feature is provided in Perl in order to match individual bytes
-in UTF-8 mode. Because it breaks up UTF-8 characters into individual bytes,
-what remains in the string may be a malformed UTF-8 string. For this reason,
-the \eC escape sequence is best avoided.
+in and out of UTF-8 mode. Unlike a dot, it can match a newline. The feature is
+provided in Perl in order to match individual bytes in UTF-8 mode. Because it
+breaks up UTF-8 characters into individual bytes, what remains in the string
+may be a malformed UTF-8 string. For this reason, the \eC escape sequence is
+best avoided.
 .P
 PCRE does not allow \eC to appear in lookbehind assertions
 .\" HTML <a href="#lookbehind">
@@ -867,18 +527,13 @@
 When caseless matching is set, any letters in a class represent both their
 upper case and lower case versions, so for example, a caseless [aeiou] matches
 "A" as well as "a", and a caseless [^aeiou] does not match "A", whereas a
-caseful version would. In UTF-8 mode, PCRE always understands the concept of
-case for characters whose values are less than 128, so caseless matching is
-always possible. For characters with higher values, the concept of case is
-supported if PCRE is compiled with Unicode property support, but not otherwise.
-If you want to use caseless matching for characters 128 and above, you must
-ensure that PCRE is compiled with Unicode property support as well as with
-UTF-8 support.
-.P
-Characters that might indicate line breaks are never treated in any special way
-when matching character classes, whatever line-ending sequence is in use, and
-whatever setting of the PCRE_DOTALL and PCRE_MULTILINE options is used. A class
-such as [^a] always matches one of these characters.
+caseful version would. When running in UTF-8 mode, PCRE supports the concept of
+case for characters with values greater than 128 only when it is compiled with
+Unicode property support.
+.P
+The newline character is never treated in any special way in character classes,
+whatever the setting of the PCRE_DOTALL or PCRE_MULTILINE options is. A class
+such as [^a] will always match a newline.
 .P
 The minus (hyphen) character can be used to specify a range of characters in a
 character class. For example, [d-m] matches any letter between d and m,
@@ -902,7 +557,7 @@
 If a range that includes letters is used when caseless matching is set, it
 matches the letters in either case. For example, [W-c] is equivalent to
 [][\e\e^_`wxyzabc], matched caselessly, and in non-UTF-8 mode, if character
-tables for a French locale are in use, [\exc8-\excb] matches accented E
+tables for the "fr_FR" locale are in use, [\exc8-\excb] matches accented E
 characters in both cases. In UTF-8 mode, PCRE supports the concept of case for
 characters with values greater than 128 only when it is compiled with Unicode
 property support.
@@ -977,9 +632,10 @@
   gilbert|sullivan
 .sp
 matches either "gilbert" or "sullivan". Any number of alternatives may appear,
-and an empty alternative is permitted (matching the empty string). The matching
-process tries each alternative in turn, from left to right, and the first one
-that succeeds is used. If the alternatives are within a subpattern
+and an empty alternative is permitted (matching the empty string).
+The matching process tries each alternative in turn, from left to right,
+and the first one that succeeds is used. If the alternatives are within a
+subpattern
 .\" HTML <a href="#subpattern">
 .\" </a>
 (defined below),
@@ -992,9 +648,8 @@
 .rs
 .sp
 The settings of the PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL, and
-PCRE_EXTENDED options (which are Perl-compatible) can be changed from within
-the pattern by a sequence of Perl option letters enclosed between "(?" and ")".
-The option letters are
+PCRE_EXTENDED options can be changed from within the pattern by a sequence of
+Perl option letters enclosed between "(?" and ")". The option letters are
 .sp
   i  for PCRE_CASELESS
   m  for PCRE_MULTILINE
@@ -1008,18 +663,14 @@
 permitted. If a letter appears both before and after the hyphen, the option is
 unset.
 .P
-The PCRE-specific options PCRE_DUPNAMES, PCRE_UNGREEDY, and PCRE_EXTRA can be
-changed in the same way as the Perl-compatible options by using the characters
-J, U and X respectively.
-.P
 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.
 If the change is placed right at the start of a pattern, PCRE extracts it into
 the global options (and it will therefore show up in data extracted by the
 \fBpcre_fullinfo()\fP function).
 .P
-An option change within a subpattern (see below for a description of
-subpatterns) affects only that part of the current pattern that follows it, so
+An option change within a subpattern affects only that part of the current
+pattern that follows it, so
 .sp
   (a(?i)b)c
 .sp
@@ -1035,15 +686,11 @@
 option settings happen at compile time. There would be some very weird
 behaviour otherwise.
 .P
-\fBNote:\fP There are other PCRE-specific options that can be set by the
-application when the compile or match functions are called. In some cases the
-pattern can contain special leading sequences to override what the application
-has set or what has been defaulted. Details are given in the section entitled
-.\" HTML <a href="#newlineseq">
-.\" </a>
-"Newline sequences"
-.\"
-above.
+The PCRE-specific options PCRE_UNGREEDY and PCRE_EXTRA can be changed in the
+same way as the Perl-compatible options by using the characters U and X
+respectively. The (?X) flag setting is special in that it must always occur
+earlier in the pattern than any of the additional features it turns on, even
+when it is at top level. It is best to put it at the start.
 .
 .
 .\" HTML <a name="subpattern"></a>
@@ -1058,7 +705,7 @@
   cat(aract|erpillar|)
 .sp
 matches one of the words "cat", "cataract", or "caterpillar". Without the
-parentheses, it would match "cataract", "erpillar" or an empty string.
+parentheses, it would match "cataract", "erpillar" or the empty string.
 .sp
 2. It sets up the subpattern as a capturing subpattern. This means that, when
 the whole pattern matches, that portion of the subject string that matched the
@@ -1083,7 +730,8 @@
   the ((?:red|white) (king|queen))
 .sp
 the captured substrings are "white queen" and "queen", and are numbered 1 and
-2. The maximum number of capturing subpatterns is 65535.
+2. The maximum number of capturing subpatterns is 65535, and the maximum depth
+of nesting of all subpatterns, both capturing and non-capturing, is 200.
 .P
 As a convenient shorthand, if any option settings are required at the start of
 a non-capturing subpattern, the option letters may appear between the "?" and
@@ -1098,96 +746,20 @@
 the above patterns match "SUNDAY" as well as "Saturday".
 .
 .
-.SH "DUPLICATE SUBPATTERN NUMBERS"
-.rs
-.sp
-Perl 5.10 introduced a feature whereby each alternative in a subpattern uses
-the same numbers for its capturing parentheses. Such a subpattern starts with
-(?| and is itself a non-capturing subpattern. For example, consider this
-pattern:
-.sp
-  (?|(Sat)ur|(Sun))day
-.sp
-Because the two alternatives are inside a (?| group, both sets of capturing
-parentheses are numbered one. Thus, when the pattern matches, you can look
-at captured substring number one, whichever alternative matched. This construct
-is useful when you want to capture part, but not all, of one of a number of
-alternatives. Inside a (?| group, parentheses are numbered as usual, but the
-number is reset at the start of each branch. The numbers of any capturing
-buffers that follow the subpattern start after the highest number used in any
-branch. The following example is taken from the Perl documentation.
-The numbers underneath show in which buffer the captured content will be
-stored.
-.sp
-  # before  ---------------branch-reset----------- after
-  / ( a )  (?| x ( y ) z | (p (q) r) | (t) u (v) ) ( z ) /x
-  # 1            2         2  3        2     3     4
-.sp
-A backreference or a recursive call to a numbered subpattern always refers to
-the first one in the pattern with the given number.
-.P
-An alternative approach to using this "branch reset" feature is to use
-duplicate named subpatterns, as described in the next section.
-.
-.
 .SH "NAMED SUBPATTERNS"
 .rs
 .sp
 Identifying capturing parentheses by number is simple, but it can be very hard
 to keep track of the numbers in complicated regular expressions. Furthermore,
 if an expression is modified, the numbers may change. To help with this
-difficulty, PCRE supports the naming of subpatterns. This feature was not
-added to Perl until release 5.10. Python had the feature earlier, and PCRE
-introduced it at release 4.0, using the Python syntax. PCRE now supports both
-the Perl and the Python syntax.
-.P
-In PCRE, a subpattern can be named in one of three ways: (?<name>...) or
-(?'name'...) as in Perl, or (?P<name>...) as in Python. References to capturing
-parentheses from other parts of the pattern, such as
-.\" HTML <a href="#backreferences">
-.\" </a>
-backreferences,
-.\"
-.\" HTML <a href="#recursion">
-.\" </a>
-recursion,
-.\"
-and
-.\" HTML <a href="#conditions">
-.\" </a>
-conditions,
-.\"
-can be made by name as well as by number.
-.P
-Names consist of up to 32 alphanumeric characters and underscores. Named
-capturing parentheses are still allocated numbers as well as names, exactly as
-if the names were not present. The PCRE API provides function calls for
-extracting the name-to-number translation table from a compiled pattern. There
-is also a convenience function for extracting a captured substring by name.
-.P
-By default, a name must be unique within a pattern, but it is possible to relax
-this constraint by setting the PCRE_DUPNAMES option at compile time. This can
-be useful for patterns where only one instance of the named parentheses can
-match. Suppose you want to match the name of a weekday, either as a 3-letter
-abbreviation or as the full name, and in both cases you want to extract the
-abbreviation. This pattern (ignoring the line breaks) does the job:
-.sp
-  (?<DN>Mon|Fri|Sun)(?:day)?|
-  (?<DN>Tue)(?:sday)?|
-  (?<DN>Wed)(?:nesday)?|
-  (?<DN>Thu)(?:rsday)?|
-  (?<DN>Sat)(?:urday)?
-.sp
-There are five capturing substrings, but only one is ever set after a match.
-(An alternative way of solving this problem is to use a "branch reset"
-subpattern, as described in the previous section.)
-.P
-The convenience function for extracting the data by name returns the substring
-for the first (and in this example, the only) subpattern of that name that
-matched. This saves searching to find which numbered subpattern it was. If you
-make a reference to a non-unique named subpattern from elsewhere in the
-pattern, the one that corresponds to the lowest number is used. For further
-details of the interfaces for handling named subpatterns, see the
+difficulty, PCRE supports the naming of subpatterns, something that Perl does
+not provide. The Python syntax (?P<name>...) is used. Names consist of
+alphanumeric characters and underscores, and must be unique within a pattern.
+.P
+Named capturing parentheses are still allocated numbers as well as names. The
+PCRE API provides function calls for extracting the name-to-number translation
+table from a compiled pattern. There is also a convenience function for
+extracting a captured substring by name. For further details see the
 .\" HREF
 \fBpcreapi\fP
 .\"
@@ -1201,10 +773,9 @@
 items:
 .sp
   a literal data character
-  the dot metacharacter
+  the . metacharacter
   the \eC escape sequence
   the \eX escape sequence (in UTF-8 mode with Unicode properties)
-  the \eR escape sequence
   an escape such as \ed that matches a single character
   a character class
   a back reference (see next section)
@@ -1242,8 +813,8 @@
 The quantifier {0} is permitted, causing the expression to behave as if the
 previous item and the quantifier were not present.
 .P
-For convenience, the three most common quantifiers have single-character
-abbreviations:
+For convenience (and historical compatibility) the three most common
+quantifiers have single-character abbreviations:
 .sp
   *    is equivalent to {0,}
   +    is equivalent to {1,}
@@ -1291,7 +862,7 @@
 which matches one digit by preference, but can match two if that is the only
 way the rest of the pattern matches.
 .P
-If the PCRE_UNGREEDY option is set (an option that is not available in Perl),
+If the PCRE_UNGREEDY option is set (an option which is not available in Perl),
 the quantifiers are not greedy by default, but individual ones can be made
 greedy by following them with a question mark. In other words, it inverts the
 default behaviour.
@@ -1301,7 +872,7 @@
 compiled pattern, in proportion to the size of the minimum or maximum.
 .P
 If a pattern starts with .* or .{0,} and the PCRE_DOTALL option (equivalent
-to Perl's /s) is set, thus allowing the dot to match newlines, the pattern is
+to Perl's /s) is set, thus allowing the . to match newlines, the pattern is
 implicitly anchored, because whatever follows will be tried against every
 character position in the subject string, so there is no point in retrying the
 overall match at any position after the first. PCRE normally treats such a
@@ -1313,8 +884,8 @@
 .P
 However, there is one situation where the optimization cannot be used. When .*
 is inside capturing parentheses that are the subject of a backreference
-elsewhere in the pattern, a match at the start may fail where a later one
-succeeds. Consider, for example:
+elsewhere in the pattern, a match at the start may fail, and a later one
+succeed. Consider, for example:
 .sp
   (.*)abc\e1
 .sp
@@ -1340,12 +911,12 @@
 .SH "ATOMIC GROUPING AND POSSESSIVE QUANTIFIERS"
 .rs
 .sp
-With both maximizing ("greedy") and minimizing ("ungreedy" or "lazy")
-repetition, failure of what follows normally causes the repeated item to be
-re-evaluated to see if a different number of repeats allows the rest of the
-pattern to match. Sometimes it is useful to prevent this, either to change the
-nature of the match, or to cause it fail earlier than it otherwise might, when
-the author of the pattern knows there is no point in carrying on.
+With both maximizing and minimizing repetition, failure of what follows
+normally causes the repeated item to be re-evaluated to see if a different
+number of repeats allows the rest of the pattern to match. Sometimes it is
+useful to prevent this, either to change the nature of the match, or to cause
+it fail earlier than it otherwise might, when the author of the pattern knows
+there is no point in carrying on.
 .P
 Consider, for example, the pattern \ed+foo when applied to the subject line
 .sp
@@ -1357,7 +928,7 @@
 (a term taken from Jeffrey Friedl's book) provides the means for specifying
 that once a subpattern has matched, it is not to be re-evaluated in this way.
 .P
-If we use atomic grouping for the previous example, the matcher gives up
+If we use atomic grouping for the previous example, the matcher would give up
 immediately on failing to match "foo" the first time. The notation is a kind of
 special parenthesis, starting with (?> as in this example:
 .sp
@@ -1387,26 +958,13 @@
 .sp
   \ed++foo
 .sp
-Note that a possessive quantifier can be used with an entire group, for
-example:
-.sp
-  (abc|xyz){2,3}+
-.sp
 Possessive quantifiers are always greedy; the setting of the PCRE_UNGREEDY
 option is ignored. They are a convenient notation for the simpler forms of
-atomic group. However, there is no difference in the meaning of a possessive
-quantifier and the equivalent atomic group, though there may be a performance
-difference; possessive quantifiers should be slightly faster.
-.P
-The possessive quantifier syntax is an extension to the Perl 5.8 syntax.
-Jeffrey Friedl originated the idea (and the name) in the first edition of his
-book. Mike McCloskey liked it, so implemented it when he built Sun's Java
-package, and PCRE copied it from there. It ultimately found its way into Perl
-at release 5.10.
-.P
-PCRE has an optimization that automatically "possessifies" certain simple
-pattern constructs. For example, the sequence A+B is treated as A++B because
-there is no point in backtracking into a sequence of A's when B must follow.
+atomic group. However, there is no difference in the meaning or processing of a
+possessive quantifier and the equivalent atomic group.
+.P
+The possessive quantifier syntax is an extension to the Perl syntax. It
+originates in Sun's Java package.
 .P
 When a pattern contains an unlimited repeat inside a subpattern that can itself
 be repeated an unlimited number of times, the use of an atomic group is the
@@ -1448,43 +1006,12 @@
 always taken as a back reference, and causes an error only if there are not
 that many capturing left parentheses in the entire pattern. In other words, the
 parentheses that are referenced need not be to the left of the reference for
-numbers less than 10. A "forward back reference" of this type can make sense
-when a repetition is involved and the subpattern to the right has participated
-in an earlier iteration.
-.P
-It is not possible to have a numerical "forward back reference" to a subpattern
-whose number is 10 or more using this syntax because a sequence such as \e50 is
-interpreted as a character defined in octal. See the subsection entitled
-"Non-printing characters"
+numbers less than 10. See the subsection entitled "Non-printing characters"
 .\" HTML <a href="#digitsafterbackslash">
 .\" </a>
 above
 .\"
-for further details of the handling of digits following a backslash. There is
-no such problem when named parentheses are used. A back reference to any
-subpattern is possible using named parentheses (see below).
-.P
-Another way of avoiding the ambiguity inherent in the use of digits following a
-backslash is to use the \eg escape sequence, which is a feature introduced in
-Perl 5.10. This escape must be followed by an unsigned number or a negative
-number, optionally enclosed in braces. These examples are all identical:
-.sp
-  (ring), \e1
-  (ring), \eg1
-  (ring), \eg{1}
-.sp
-An unsigned number specifies an absolute reference without the ambiguity that
-is present in the older syntax. It is also useful when literal digits follow
-the reference. A negative number is a relative reference. Consider this
-example:
-.sp
-  (abc(def)ghi)\eg{-1}
-.sp
-The sequence \eg{-1} is a reference to the most recently started capturing
-subpattern before \eg, that is, is it equivalent to \e2. Similarly, \eg{-2}
-would be equivalent to \e1. The use of relative references can be helpful in
-long patterns, and also in patterns that are created by joining together
-fragments that contain references within themselves.
+for further details of the handling of digits following a backslash.
 .P
 A back reference matches whatever actually matched the capturing subpattern in
 the current subject string, rather than anything matching the subpattern
@@ -1506,21 +1033,11 @@
 matches "rah rah" and "RAH RAH", but not "RAH rah", even though the original
 capturing subpattern is matched caselessly.
 .P
-There are several different ways of writing back references to named
-subpatterns. The .NET syntax \ek{name} and the Perl syntax \ek<name> or
-\ek'name' are supported, as is the Python syntax (?P=name). Perl 5.10's unified
-back reference syntax, in which \eg can be used for both numeric and named
-references, is also supported. We could rewrite the above example in any of
-the following ways:
-.sp
-  (?<p1>(?i)rah)\es+\ek<p1>
-  (?'p1'(?i)rah)\es+\ek{p1}
-  (?P<p1>(?i)rah)\es+(?P=p1)
-  (?<p1>(?i)rah)\es+\eg{p1}
+Back references to named subpatterns use the Python syntax (?P=name). We could
+rewrite the above example as follows:
+.sp
+  (?<p1>(?i)rah)\es+(?P=p1)
 .sp
-A subpattern that is referenced by name may appear in the pattern before or
-after the reference.
-.P
 There may be more than one back reference to the same subpattern. If a
 subpattern has not actually been used in a particular match, any back
 references to it always fail. For example, the pattern
@@ -1582,8 +1099,8 @@
 .SS "Lookahead assertions"
 .rs
 .sp
-Lookahead assertions start with (?= for positive assertions and (?! for
-negative assertions. For example,
+Lookahead assertions start
+with (?= for positive assertions and (?! for negative assertions. For example,
 .sp
   \ew+(?=;)
 .sp
@@ -1618,8 +1135,8 @@
 .sp
 does find an occurrence of "bar" that is not preceded by "foo". The contents of
 a lookbehind assertion are restricted such that all the strings it matches must
-have a fixed length. However, if there are several top-level alternatives, they
-do not all have to have the same fixed length. Thus
+have a fixed length. However, if there are several alternatives, they do not
+all have to have the same fixed length. Thus
 .sp
   (?<=bullock|donkey)
 .sp
@@ -1639,27 +1156,19 @@
 .sp
   (?<=abc|abde)
 .sp
-In some cases, the Perl 5.10 escape sequence \eK
-.\" HTML <a href="#resetmatchstart">
-.\" </a>
-(see above)
-.\"
-can be used instead of a lookbehind assertion; this is not restricted to a
-fixed-length.
-.P
 The implementation of lookbehind assertions is, for each alternative, to
-temporarily move the current position back by the fixed length and then try to
+temporarily move the current position back by the fixed width and then try to
 match. If there are insufficient characters before the current position, the
-assertion fails.
+match is deemed to fail.
 .P
 PCRE does not allow the \eC escape (which matches a single byte in UTF-8 mode)
 to appear in lookbehind assertions, because it makes it impossible to calculate
-the length of the lookbehind. The \eX and \eR escapes, which can match
-different numbers of bytes, are also not permitted.
+the length of the lookbehind. The \eX escape, which can match different numbers
+of bytes, is also not permitted.
 .P
-Possessive quantifiers can be used in conjunction with lookbehind assertions to
-specify efficient matching at the end of the subject string. Consider a simple
-pattern such as
+Atomic groups can be used in conjunction with lookbehind assertions to specify
+efficient matching at the end of the subject string. Consider a simple pattern
+such as
 .sp
   abcd$
 .sp
@@ -1675,9 +1184,13 @@
 covers the entire string, from right to left, so we are no better off. However,
 if the pattern is written as
 .sp
+  ^(?>.*)(?<=abcd)
+.sp
+or, equivalently, using the possessive quantifier syntax,
+.sp
   ^.*+(?<=abcd)
 .sp
-there can be no backtracking for the .*+ item; it can match only the entire
+there can be no backtracking for the .* item; it can match only the entire
 string. The subsequent lookbehind assertion does a single test on the last four
 characters. If it fails, the match fails immediately. For long strings, this
 approach makes a significant difference to the processing time.
@@ -1717,7 +1230,6 @@
 characters that are not "999".
 .
 .
-.\" HTML <a name="conditions"></a>
 .SH "CONDITIONAL SUBPATTERNS"
 .rs
 .sp
@@ -1733,23 +1245,12 @@
 no-pattern (if present) is used. If there are more than two alternatives in the
 subpattern, a compile-time error occurs.
 .P
-There are four kinds of condition: references to subpatterns, references to
-recursion, a pseudo-condition called DEFINE, and assertions.
-.
-.SS "Checking for a used subpattern by number"
-.rs
-.sp
-If the text between the parentheses consists of a sequence of digits, the
-condition is true if the capturing subpattern of that number has previously
-matched. An alternative notation is to precede the digits with a plus or minus
-sign. In this case, the subpattern number is relative rather than absolute.
-The most recently opened parentheses can be referenced by (?(-1), the next most
-recent by (?(-2), and so on. In looping constructs it can also make sense to
-refer to subsequent groups with constructs such as (?(+2).
-.P
-Consider the following pattern, which contains non-significant white space to
-make it more readable (assume the PCRE_EXTENDED option) and to divide it into
-three parts for ease of discussion:
+There are three kinds of condition. If the text between the parentheses
+consists of a sequence of digits, the condition is satisfied if the capturing
+subpattern of that number has previously matched. The number must be greater
+than zero. Consider the following pattern, which contains non-significant white
+space to make it more readable (assume the PCRE_EXTENDED option) and to divide
+it into three parts for ease of discussion:
 .sp
   ( \e( )?    [^()]+    (?(1) \e) )
 .sp
@@ -1763,74 +1264,11 @@
 subpattern matches nothing. In other words, this pattern matches a sequence of
 non-parentheses, optionally enclosed in parentheses.
 .P
-If you were embedding this pattern in a larger one, you could use a relative
-reference:
-.sp
-  ...other stuff... ( \e( )?    [^()]+    (?(-1) \e) ) ...
-.sp
-This makes the fragment independent of the parentheses in the larger pattern.
-.
-.SS "Checking for a used subpattern by name"
-.rs
-.sp
-Perl uses the syntax (?(<name>)...) or (?('name')...) to test for a used
-subpattern by name. For compatibility with earlier versions of PCRE, which had
-this facility before Perl, the syntax (?(name)...) is also recognized. However,
-there is a possible ambiguity with this syntax, because subpattern names may
-consist entirely of digits. PCRE looks first for a named subpattern; if it
-cannot find one and the name consists entirely of digits, PCRE looks for a
-subpattern of that number, which must be greater than zero. Using subpattern
-names that consist entirely of digits is not recommended.
-.P
-Rewriting the above example to use a named subpattern gives this:
-.sp
-  (?<OPEN> \e( )?    [^()]+    (?(<OPEN>) \e) )
-.sp
-.
-.SS "Checking for pattern recursion"
-.rs
-.sp
-If the condition is the string (R), and there is no subpattern with the name R,
-the condition is true if a recursive call to the whole pattern or any
-subpattern has been made. If digits or a name preceded by ampersand follow the
-letter R, for example:
-.sp
-  (?(R3)...) or (?(R&name)...)
-.sp
-the condition is true if the most recent recursion is into the subpattern whose
-number or name is given. This condition does not check the entire recursion
-stack.
-.P
-At "top level", all these recursion test conditions are false. Recursive
-patterns are described below.
-.
-.SS "Defining subpatterns for use by reference only"
-.rs
-.sp
-If the condition is the string (DEFINE), and there is no subpattern with the
-name DEFINE, the condition is always false. In this case, there may be only one
-alternative in the subpattern. It is always skipped if control reaches this
-point in the pattern; the idea of DEFINE is that it can be used to define
-"subroutines" that can be referenced from elsewhere. (The use of "subroutines"
-is described below.) For example, a pattern to match an IPv4 address could be
-written like this (ignore whitespace and line breaks):
-.sp
-  (?(DEFINE) (?<byte> 2[0-4]\ed | 25[0-5] | 1\ed\ed | [1-9]?\ed) )
-  \eb (?&byte) (\e.(?&byte)){3} \eb
-.sp
-The first part of the pattern is a DEFINE group inside which a another group
-named "byte" is defined. This matches an individual component of an IPv4
-address (a number less than 256). When matching takes place, this part of the
-pattern is skipped because DEFINE acts like a false condition.
+If the condition is the string (R), it is satisfied if a recursive call to the
+pattern or subpattern has been made. At "top level", the condition is false.
+This is a PCRE extension. Recursive patterns are described in the next section.
 .P
-The rest of the pattern uses references to the named group to match the four
-dot-separated components of an IPv4 address, insisting on a word boundary at
-each end.
-.
-.SS "Assertion conditions"
-.rs
-.sp
-If the condition is not in any of the above formats, it must be an assertion.
+If the condition is not a sequence of digits or (R), it must be an assertion.
 This may be a positive or negative lookahead or lookbehind assertion. Consider
 this pattern, again containing non-significant white space, and with the two
 alternatives on the second line:
@@ -1855,54 +1293,43 @@
 that make up a comment play no part in the pattern matching at all.
 .P
 If the PCRE_EXTENDED option is set, an unescaped # character outside a
-character class introduces a comment that continues to immediately after the
-next newline in the pattern.
+character class introduces a comment that continues up to the next newline
+character in the pattern.
 .
 .
-.\" HTML <a name="recursion"></a>
 .SH "RECURSIVE PATTERNS"
 .rs
 .sp
 Consider the problem of matching a string in parentheses, allowing for
 unlimited nested parentheses. Without the use of recursion, the best that can
 be done is to use a pattern that matches up to some fixed depth of nesting. It
-is not possible to handle an arbitrary nesting depth.
-.P
-For some time, Perl has provided a facility that allows regular expressions to
-recurse (amongst other things). It does this by interpolating Perl code in the
-expression at run time, and the code can refer to the expression itself. A Perl
-pattern using code interpolation to solve the parentheses problem can be
-created like this:
+is not possible to handle an arbitrary nesting depth. Perl provides a facility
+that allows regular expressions to recurse (amongst other things). It does this
+by interpolating Perl code in the expression at run time, and the code can
+refer to the expression itself. A Perl pattern to solve the parentheses problem
+can be created like this:
 .sp
   $re = qr{\e( (?: (?>[^()]+) | (?p{$re}) )* \e)}x;
 .sp
 The (?p{...}) item interpolates Perl code at run time, and in this case refers
-recursively to the pattern in which it appears.
+recursively to the pattern in which it appears. Obviously, PCRE cannot support
+the interpolation of Perl code. Instead, it supports some special syntax for
+recursion of the entire pattern, and also for individual subpattern recursion.
+.P
+The special item that consists of (? followed by a number greater than zero and
+a closing parenthesis is a recursive call of the subpattern of the given
+number, provided that it occurs inside that subpattern. (If not, it is a
+"subroutine" call, which is described in the next section.) The special item
+(?R) is a recursive call of the entire regular expression.
 .P
-Obviously, PCRE cannot support the interpolation of Perl code. Instead, it
-supports special syntax for recursion of the entire pattern, and also for
-individual subpattern recursion. After its introduction in PCRE and Python,
-this kind of recursion was introduced into Perl at release 5.10.
-.P
-A special item that consists of (? followed by a number greater than zero and a
-closing parenthesis is a recursive call of the subpattern of the given number,
-provided that it occurs inside that subpattern. (If not, it is a "subroutine"
-call, which is described in the next section.) The special item (?R) or (?0) is
-a recursive call of the entire regular expression.
-.P
-In PCRE (like Python, but unlike Perl), a recursive subpattern call is always
-treated as an atomic group. That is, once it has matched some of the subject
-string, it is never re-entered, even if it contains untried alternatives and
-there is a subsequent matching failure.
-.P
-This PCRE pattern solves the nested parentheses problem (assume the
-PCRE_EXTENDED option is set so that white space is ignored):
+For example, this PCRE pattern solves the nested parentheses problem (assume
+the PCRE_EXTENDED option is set so that white space is ignored):
 .sp
   \e( ( (?>[^()]+) | (?R) )* \e)
 .sp
 First it matches an opening parenthesis. Then it matches any number of
 substrings which can either be a sequence of non-parentheses, or a recursive
-match of the pattern itself (that is, a correctly parenthesized substring).
+match of the pattern itself (that is a correctly parenthesized substring).
 Finally there is a closing parenthesis.
 .P
 If this were part of a larger pattern, you would not want to recurse the entire
@@ -1911,33 +1338,18 @@
   ( \e( ( (?>[^()]+) | (?1) )* \e) )
 .sp
 We have put the pattern into parentheses, and caused the recursion to refer to
-them instead of the whole pattern.
-.P
-In a larger pattern, keeping track of parenthesis numbers can be tricky. This
-is made easier by the use of relative references. (A Perl 5.10 feature.)
-Instead of (?1) in the pattern above you can write (?-2) to refer to the second
-most recently opened parentheses preceding the recursion. In other words, a
-negative number counts capturing parentheses leftwards from the point at which
-it is encountered.
-.P
-It is also possible to refer to subsequently opened parentheses, by writing
-references such as (?+2). However, these cannot be recursive because the
-reference is not inside the parentheses that are referenced. They are always
-"subroutine" calls, as described in the next section.
-.P
-An alternative approach is to use named parentheses instead. The Perl syntax
-for this is (?&name); PCRE's earlier syntax (?P>name) is also supported. We
-could rewrite the above example as follows:
-.sp
-  (?<pn> \e( ( (?>[^()]+) | (?&pn) )* \e) )
-.sp
-If there is more than one subpattern with the same name, the earliest one is
-used.
-.P
-This particular example pattern that we have been looking at contains nested
-unlimited repeats, and so the use of atomic grouping for matching strings of
-non-parentheses is important when applying the pattern to strings that do not
-match. For example, when this pattern is applied to
+them instead of the whole pattern. In a larger pattern, keeping track of
+parenthesis numbers can be tricky. It may be more convenient to use named
+parentheses instead. For this, PCRE uses (?P>name), which is an extension to
+the Python syntax that PCRE uses for named parentheses (Perl does not provide
+named parentheses). We could rewrite the above example as follows:
+.sp
+  (?P<pn> \e( ( (?>[^()]+) | (?P>pn) )* \e) )
+.sp
+This particular example pattern contains nested unlimited repeats, and so the
+use of atomic grouping for matching strings of non-parentheses is important
+when applying the pattern to strings that do not match. For example, when this
+pattern is applied to
 .sp
   (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa()
 .sp
@@ -1949,7 +1361,7 @@
 At the end of a match, the values set for any capturing subpatterns are those
 from the outermost level of the recursion at which the subpattern value is set.
 If you want to obtain intermediate values, a callout function can be used (see
-below and the
+the next section and the
 .\" HREF
 \fBpcrecallout\fP
 .\"
@@ -1988,15 +1400,8 @@
 .sp
 If the syntax for a recursive subpattern reference (either by number or by
 name) is used outside the parentheses to which it refers, it operates like a
-subroutine in a programming language. The "called" subpattern may be defined
-before or after the reference. A numbered reference can be absolute or
-relative, as in these examples:
-.sp
-  (...(absolute)...)...(?2)...
-  (...(relative)...)...(?-1)...
-  (...(?+1)...(relative)...
-.sp
-An earlier example pointed out that the pattern
+subroutine in a programming language. An earlier example pointed out that the
+pattern
 .sp
   (sens|respons)e and \e1ibility
 .sp
@@ -2006,21 +1411,8 @@
   (sens|respons)e and (?1)ibility
 .sp
 is used, it does match "sense and responsibility" as well as the other two
-strings. Another example is given in the discussion of DEFINE above.
-.P
-Like recursive subpatterns, a "subroutine" call is always treated as an atomic
-group. That is, once it has matched some of the subject string, it is never
-re-entered, even if it contains untried alternatives and there is a subsequent
-matching failure.
-.P
-When a subpattern is used as a subroutine, processing options such as
-case-independence are fixed when the subpattern is defined. They cannot be
-changed for different calls. For example, consider this pattern:
-.sp
-  (abc)(?i:(?-1))
-.sp
-It matches "abcabc". It does not match "abcABC" because the change of
-processing option does not affect the called subpattern.
+strings. Such references must, however, follow the subpattern to which they
+refer.
 .
 .
 .SH CALLOUTS
@@ -2041,7 +1433,7 @@
 can put a number less than 256 after the letter C. The default value is zero.
 For example, this pattern has two callout points:
 .sp
-  (?C1)abc(?C2)def
+  (?C1)\dabc(?C2)def
 .sp
 If the PCRE_AUTO_CALLOUT flag is passed to \fBpcre_compile()\fP, callouts are
 automatically installed before each item in the pattern. They are all numbered
@@ -2057,141 +1449,8 @@
 \fBpcrecallout\fP
 .\"
 documentation.
-.
-.
-.SH "BACKTRACKING CONTROL"
-.rs
-.sp
-Perl 5.10 introduced a number of "Special Backtracking Control Verbs", which
-are described in the Perl documentation as "experimental and subject to change
-or removal in a future version of Perl". It goes on to say: "Their usage in
-production code should be noted to avoid problems during upgrades." The same
-remarks apply to the PCRE features described in this section.
-.P
-Since these verbs are specifically related to backtracking, they can be used
-only when the pattern is to be matched using \fBpcre_exec()\fP, which uses a
-backtracking algorithm. They cause an error if encountered by
-\fBpcre_dfa_exec()\fP.
 .P
-The new verbs make use of what was previously invalid syntax: an opening
-parenthesis followed by an asterisk. In Perl, they are generally of the form
-(*VERB:ARG) but PCRE does not support the use of arguments, so its general
-form is just (*VERB). Any number of these verbs may occur in a pattern. There
-are two kinds:
-.
-.SS "Verbs that act immediately"
-.rs
-.sp
-The following verbs act as soon as they are encountered:
-.sp
-   (*ACCEPT)
-.sp
-This verb causes the match to end successfully, skipping the remainder of the
-pattern. When inside a recursion, only the innermost pattern is ended
-immediately. PCRE differs from Perl in what happens if the (*ACCEPT) is inside
-capturing parentheses. In Perl, the data so far is captured: in PCRE no data is
-captured. For example:
-.sp
-  A(A|B(*ACCEPT)|C)D
-.sp
-This matches "AB", "AAD", or "ACD", but when it matches "AB", no data is
-captured.
-.sp
-  (*FAIL) or (*F)
-.sp
-This verb causes the match to fail, forcing backtracking to occur. It is
-equivalent to (?!) but easier to read. The Perl documentation notes that it is
-probably useful only when combined with (?{}) or (??{}). Those are, of course,
-Perl features that are not present in PCRE. The nearest equivalent is the
-callout feature, as for example in this pattern:
-.sp
-  a+(?C)(*FAIL)
-.sp
-A match with the string "aaaa" always fails, but the callout is taken before
-each backtrack happens (in this example, 10 times).
-.
-.SS "Verbs that act after backtracking"
-.rs
-.sp
-The following verbs do nothing when they are encountered. Matching continues
-with what follows, but if there is no subsequent match, a failure is forced.
-The verbs differ in exactly what kind of failure occurs.
-.sp
-  (*COMMIT)
-.sp
-This verb causes the whole match to fail outright if the rest of the pattern
-does not match. Even if the pattern is unanchored, no further attempts to find
-a match by advancing the start point take place. Once (*COMMIT) has been
-passed, \fBpcre_exec()\fP is committed to finding a match at the current
-starting point, or not at all. For example:
-.sp
-  a+(*COMMIT)b
-.sp
-This matches "xxaab" but not "aacaab". It can be thought of as a kind of
-dynamic anchor, or "I've started, so I must finish."
-.sp
-  (*PRUNE)
-.sp
-This verb causes the match to fail at the current position if the rest of the
-pattern does not match. If the pattern is unanchored, the normal "bumpalong"
-advance to the next starting character then happens. Backtracking can occur as
-usual to the left of (*PRUNE), or when matching to the right of (*PRUNE), but
-if there is no match to the right, backtracking cannot cross (*PRUNE).
-In simple cases, the use of (*PRUNE) is just an alternative to an atomic
-group or possessive quantifier, but there are some uses of (*PRUNE) that cannot
-be expressed in any other way.
-.sp
-  (*SKIP)
-.sp
-This verb is like (*PRUNE), except that if the pattern is unanchored, the
-"bumpalong" advance is not to the next character, but to the position in the
-subject where (*SKIP) was encountered. (*SKIP) signifies that whatever text
-was matched leading up to it cannot be part of a successful match. Consider:
-.sp
-  a+(*SKIP)b
-.sp
-If the subject is "aaaac...", after the first match attempt fails (starting at
-the first character in the string), the starting point skips on to start the
-next attempt at "c". Note that a possessive quantifer does not have the same
-effect in this example; although it would suppress backtracking during the
-first match attempt, the second attempt would start at the second character
-instead of skipping on to "c".
-.sp
-  (*THEN)
-.sp
-This verb causes a skip to the next alternation if the rest of the pattern does
-not match. That is, it cancels pending backtracking, but only within the
-current alternation. Its name comes from the observation that it can be used
-for a pattern-based if-then-else block:
-.sp
-  ( COND1 (*THEN) FOO | COND2 (*THEN) BAR | COND3 (*THEN) BAZ ) ...
-.sp
-If the COND1 pattern matches, FOO is tried (and possibly further items after
-the end of the group if FOO succeeds); on failure the matcher skips to the
-second alternative and tries COND2, without backtracking into COND1. If (*THEN)
-is used outside of any alternation, it acts exactly like (*PRUNE).
-.
-.
-.SH "SEE ALSO"
-.rs
-.sp
-\fBpcreapi\fP(3), \fBpcrecallout\fP(3), \fBpcrematching\fP(3), \fBpcre\fP(3).
-.
-.
-.SH AUTHOR
-.rs
-.sp
-.nf
-Philip Hazel
-University Computing Service
-Cambridge CB2 3QH, England.
-.fi
-.
-.
-.SH REVISION
-.rs
-.sp
-.nf
-Last updated: 17 September 2007
-Copyright (c) 1997-2007 University of Cambridge.
-.fi
+.in 0
+Last updated: 09 September 2004
+.br
+Copyright (c) 1997-2004 University of Cambridge.

Modified: httpd/httpd/vendor/pcre/current/doc/pcreperform.3
URL: http://svn.apache.org/viewvc/httpd/httpd/vendor/pcre/current/doc/pcreperform.3?rev=598343&r1=598342&r2=598343&view=diff
==============================================================================
--- httpd/httpd/vendor/pcre/current/doc/pcreperform.3 (original)
+++ httpd/httpd/vendor/pcre/current/doc/pcreperform.3 Mon Nov 26 09:04:19 2007
@@ -1,78 +1,16 @@
-.TH PCREPERFORM 3
+.TH PCRE 3
 .SH NAME
 PCRE - Perl-compatible regular expressions
 .SH "PCRE PERFORMANCE"
 .rs
 .sp
-Two aspects of performance are discussed below: memory usage and processing
-time. The way you express your pattern as a regular expression can affect both
-of them.
-.
-.SH "MEMORY USAGE"
-.rs
-.sp
-Patterns are compiled by PCRE into a reasonably efficient byte code, so that
-most simple patterns do not use much memory. However, there is one case where
-memory usage can be unexpectedly large. When a parenthesized subpattern has a
-quantifier with a minimum greater than 1 and/or a limited maximum, the whole
-subpattern is repeated in the compiled code. For example, the pattern
-.sp
-  (abc|def){2,4}
-.sp
-is compiled as if it were
-.sp
-  (abc|def)(abc|def)((abc|def)(abc|def)?)?
-.sp
-(Technical aside: It is done this way so that backtrack points within each of
-the repetitions can be independently maintained.)
-.P
-For regular expressions whose quantifiers use only small numbers, this is not
-usually a problem. However, if the numbers are large, and particularly if such
-repetitions are nested, the memory usage can become an embarrassment. For
-example, the very simple pattern
-.sp
-  ((ab){1,1000}c){1,3}
-.sp
-uses 51K bytes when compiled. When PCRE is compiled with its default internal
-pointer size of two bytes, the size limit on a compiled pattern is 64K, and
-this is reached with the above pattern if the outer repetition is increased
-from 3 to 4. PCRE can be compiled to use larger internal pointers and thus
-handle larger compiled patterns, but it is better to try to rewrite your
-pattern to use less memory if you can.
-.P
-One way of reducing the memory usage for such patterns is to make use of PCRE's
-.\" HTML <a href="pcrepattern.html#subpatternsassubroutines">
-.\" </a>
-"subroutine"
-.\"
-facility. Re-writing the above pattern as
-.sp
-  ((ab)(?2){0,999}c)(?1){0,2}
-.sp
-reduces the memory requirements to 18K, and indeed it remains under 20K even
-with the outer repetition increased to 100. However, this pattern is not
-exactly equivalent, because the "subroutine" calls are treated as
-.\" HTML <a href="pcrepattern.html#atomicgroup">
-.\" </a>
-atomic groups
-.\"
-into which there can be no backtracking if there is a subsequent matching
-failure. Therefore, PCRE cannot do this kind of rewriting automatically.
-Furthermore, there is a noticeable loss of speed when executing the modified
-pattern. Nevertheless, if the atomic grouping is not a problem and the loss of
-speed is acceptable, this kind of rewriting will allow you to process patterns
-that PCRE cannot otherwise handle.
-.
-.SH "PROCESSING TIME"
-.rs
-.sp
-Certain items in regular expression patterns are processed more efficiently
+Certain items that may appear in regular expression patterns are more efficient
 than others. It is more efficient to use a character class like [aeiou] than a
-set of single-character alternatives such as (a|e|i|o|u). In general, the
-simplest construction that provides the required behaviour is usually the most
-efficient. Jeffrey Friedl's book contains a lot of useful general discussion
-about optimizing regular expressions for efficient performance. This document
-contains a few observations about PCRE.
+set of alternatives such as (a|e|i|o|u). In general, the simplest construction
+that provides the required behaviour is usually the most efficient. Jeffrey
+Friedl's book contains a lot of useful general discussion about optimizing
+regular expressions for efficient performance. This document contains a few
+observations about PCRE.
 .P
 Using Unicode character properties (the \ep, \eP, and \eX escapes) is slow,
 because PCRE has to scan a structure that contains data for over fifteen
@@ -97,22 +35,21 @@
 .P
 If you are using such a pattern with subject strings that do not contain
 newlines, the best performance is obtained by setting PCRE_DOTALL, or starting
-the pattern with ^.* or ^.*? to indicate explicit anchoring. That saves PCRE
-from having to scan along the subject looking for a newline to restart at.
+the pattern with ^.* to indicate explicit anchoring. That saves PCRE from
+having to scan along the subject looking for a newline to restart at.
 .P
 Beware of patterns that contain nested indefinite repeats. These can take a
 long time to run when applied to a string that does not match. Consider the
 pattern fragment
 .sp
-  ^(a+)*
+  (a+)*
 .sp
-This can match "aaaa" in 16 different ways, and this number increases very
+This can match "aaaa" in 33 different ways, and this number increases very
 rapidly as the string gets longer. (The * repeat can match 0, 1, 2, 3, or 4
-times, and for each of those cases other than 0 or 4, the + repeats can match
+times, and for each of those cases other than 0, the + repeats can match
 different numbers of times.) When the remainder of the pattern is such that the
 entire match is going to fail, PCRE has in principle to try every possible
-variation, and this can take an extremely long time, even for relatively short
-strings.
+variation, and this can take an extremely long time.
 .P
 An optimization catches some of the more simple cases such as
 .sp
@@ -132,22 +69,8 @@
 .P
 In many cases, the solution to this kind of performance issue is to use an
 atomic group or a possessive quantifier.
-.
-.
-.SH AUTHOR
-.rs
-.sp
-.nf
-Philip Hazel
-University Computing Service
-Cambridge CB2 3QH, England.
-.fi
-.
-.
-.SH REVISION
-.rs
-.sp
-.nf
-Last updated: 06 March 2007
-Copyright (c) 1997-2007 University of Cambridge.
-.fi
+.P
+.in 0
+Last updated: 09 September 2004
+.br
+Copyright (c) 1997-2004 University of Cambridge.

Modified: httpd/httpd/vendor/pcre/current/doc/pcreposix.3
URL: http://svn.apache.org/viewvc/httpd/httpd/vendor/pcre/current/doc/pcreposix.3?rev=598343&r1=598342&r2=598343&view=diff
==============================================================================
--- httpd/httpd/vendor/pcre/current/doc/pcreposix.3 (original)
+++ httpd/httpd/vendor/pcre/current/doc/pcreposix.3 Mon Nov 26 09:04:19 2007
@@ -1,4 +1,4 @@
-.TH PCREPOSIX 3
+.TH PCRE 3
 .SH NAME
 PCRE - Perl-compatible regular expressions.
 .SH "SYNOPSIS OF POSIX API"
@@ -7,18 +7,22 @@
 .B #include <pcreposix.h>
 .PP
 .SM
+.br
 .B int regcomp(regex_t *\fIpreg\fP, const char *\fIpattern\fP,
 .ti +5n
 .B int \fIcflags\fP);
 .PP
+.br
 .B int regexec(regex_t *\fIpreg\fP, const char *\fIstring\fP,
 .ti +5n
 .B size_t \fInmatch\fP, regmatch_t \fIpmatch\fP[], int \fIeflags\fP);
 .PP
+.br
 .B size_t regerror(int \fIerrcode\fP, const regex_t *\fIpreg\fP,
 .ti +5n
 .B char *\fIerrbuf\fP, size_t \fIerrbuf_size\fP);
 .PP
+.br
 .B void regfree(regex_t *\fIpreg\fP);
 .
 .SH DESCRIPTION
@@ -29,8 +33,8 @@
 .\" HREF
 \fBpcreapi\fP
 .\"
-documentation for a description of PCRE's native API, which contains much
-additional functionality.
+documentation for a description of PCRE's native API, which contains additional
+functionality.
 .P
 The functions described here are just wrapper functions that ultimately call
 the PCRE native API. Their prototypes are defined in the \fBpcreposix.h\fP
@@ -40,10 +44,10 @@
 call the native ones, it is also necessary to add \fB-lpcre\fP.
 .P
 I have implemented only those option bits that can be reasonably mapped to PCRE
-native options. In addition, the option REG_EXTENDED is defined with the value
-zero. This has no effect, but since programs that are written to the POSIX
-interface often use it, this makes it easier to slot in PCRE as a replacement
-library. Other POSIX options are not even defined.
+native options. In addition, the options REG_EXTENDED and REG_NOSUB are defined
+with the value zero. They have no effect, but since programs that are written
+to the POSIX interface often use them, this makes it easier to slot in PCRE as
+a replacement library. Other POSIX options are not even defined.
 .P
 When PCRE is called via these functions, it is only the API that is POSIX-like
 in style. The syntax and semantics of the regular expressions themselves are
@@ -67,42 +71,21 @@
 internal form. The pattern is a C string terminated by a binary zero, and
 is passed in the argument \fIpattern\fP. The \fIpreg\fP argument is a pointer
 to a \fBregex_t\fP structure that is used as a base for storing information
-about the compiled regular expression.
+about the compiled expression.
 .P
 The argument \fIcflags\fP is either zero, or contains one or more of the bits
 defined by the following macros:
 .sp
-  REG_DOTALL
-.sp
-The PCRE_DOTALL option is set when the regular expression is passed for
-compilation to the native function. Note that REG_DOTALL is not part of the
-POSIX standard.
-.sp
   REG_ICASE
 .sp
-The PCRE_CASELESS option is set when the regular expression is passed for
-compilation to the native function.
+The PCRE_CASELESS option is set when the expression is passed for compilation
+to the native function.
 .sp
   REG_NEWLINE
 .sp
-The PCRE_MULTILINE option is set when the regular expression is passed for
-compilation to the native function. Note that this does \fInot\fP mimic the
-defined POSIX behaviour for REG_NEWLINE (see the following section).
-.sp
-  REG_NOSUB
-.sp
-The PCRE_NO_AUTO_CAPTURE option is set when the regular expression is passed
-for compilation to the native function. In addition, when a pattern that is
-compiled with this flag is passed to \fBregexec()\fP for matching, the
-\fInmatch\fP and \fIpmatch\fP arguments are ignored, and no captured strings
-are returned.
-.sp
-  REG_UTF8
-.sp
-The PCRE_UTF8 option is set when the regular expression is passed for
-compilation to the native function. This causes the pattern itself and all data
-strings used for matching it to be treated as UTF-8 strings. Note that REG_UTF8
-is not part of the POSIX standard.
+The PCRE_MULTILINE option is set when the expression is passed for compilation
+to the native function. Note that this does \fInot\fP mimic the defined POSIX
+behaviour for REG_NEWLINE (see the following section).
 .P
 In the absence of these flags, no options are passed to the native function.
 This means the the regex is compiled with PCRE default semantics. In
@@ -170,19 +153,15 @@
 The PCRE_NOTEOL option is set when calling the underlying PCRE matching
 function.
 .P
-If the pattern was compiled with the REG_NOSUB flag, no data about any matched
-strings is returned. The \fInmatch\fP and \fIpmatch\fP arguments of
-\fBregexec()\fP are ignored.
-.P
-Otherwise,the portion of the string that was matched, and also any captured
-substrings, are returned via the \fIpmatch\fP argument, which points to an
-array of \fInmatch\fP structures of type \fIregmatch_t\fP, containing the
-members \fIrm_so\fP and \fIrm_eo\fP. These contain the offset to the first
-character of each substring and the offset to the first character after the end
-of each substring, respectively. The 0th element of the vector relates to the
-entire portion of \fIstring\fP that was matched; subsequent elements relate to
-the capturing subpatterns of the regular expression. Unused entries in the
-array have both structure members set to -1.
+The portion of the string that was matched, and also any captured substrings,
+are returned via the \fIpmatch\fP argument, which points to an array of
+\fInmatch\fP structures of type \fIregmatch_t\fP, containing the members
+\fIrm_so\fP and \fIrm_eo\fP. These contain the offset to the first character of
+each substring and the offset to the first character after the end of each
+substring, respectively. The 0th element of the vector relates to the entire
+portion of \fIstring\fP that was matched; subsequent elements relate to the
+capturing subpatterns of the regular expression. Unused entries in the array
+have both structure members set to -1.
 .P
 A successful match yields a zero return; various error codes are defined in the
 header file, of which REG_NOMATCH is the "expected" failure code.
@@ -210,17 +189,13 @@
 .SH AUTHOR
 .rs
 .sp
-.nf
-Philip Hazel
-University Computing Service
-Cambridge CB2 3QH, England.
-.fi
-.
-.
-.SH REVISION
-.rs
-.sp
-.nf
-Last updated: 06 March 2007
-Copyright (c) 1997-2007 University of Cambridge.
-.fi
+Philip Hazel <ph10@cam.ac.uk>
+.br
+University Computing Service,
+.br
+Cambridge CB2 3QG, England.
+.P
+.in 0
+Last updated: 07 September 2004
+.br
+Copyright (c) 1997-2004 University of Cambridge.

Modified: httpd/httpd/vendor/pcre/current/doc/pcreprecompile.3
URL: http://svn.apache.org/viewvc/httpd/httpd/vendor/pcre/current/doc/pcreprecompile.3?rev=598343&r1=598342&r2=598343&view=diff
==============================================================================
--- httpd/httpd/vendor/pcre/current/doc/pcreprecompile.3 (original)
+++ httpd/httpd/vendor/pcre/current/doc/pcreprecompile.3 Mon Nov 26 09:04:19 2007
@@ -1,4 +1,4 @@
-.TH PCREPRECOMPILE 3
+.TH PCRE 3
 .SH NAME
 PCRE - Perl-compatible regular expressions
 .SH "SAVING AND RE-USING PRECOMPILED PCRE PATTERNS"
@@ -17,9 +17,7 @@
 If you save compiled patterns to a file, you can copy them to a different host
 and run them there. This works even if the new host has the opposite endianness
 to the one on which the patterns were compiled. There may be a small
-performance penalty, but it should be insignificant. However, compiling regular
-expressions with one version of PCRE for use with a different version is not
-guaranteed to work and may cause crashes.
+performance penalty, but it should be insignificant.
 .
 .
 .SH "SAVING A COMPILED PATTERN"
@@ -81,16 +79,15 @@
 .rs
 .sp
 Re-using a precompiled pattern is straightforward. Having reloaded it into main
-memory, you pass its pointer to \fBpcre_exec()\fP or \fBpcre_dfa_exec()\fP in
-the usual way. This should work even on another host, and even if that host has
-the opposite endianness to the one where the pattern was compiled.
+memory, you pass its pointer to \fBpcre_exec()\fP in the usual way. This should
+work even on another host, and even if that host has the opposite endianness to
+the one where the pattern was compiled.
 .P
 However, if you passed a pointer to custom character tables when the pattern
 was compiled (the \fItableptr\fP argument of \fBpcre_compile()\fP), you must
-now pass a similar pointer to \fBpcre_exec()\fP or \fBpcre_dfa_exec()\fP,
-because the value saved with the compiled pattern will obviously be nonsense. A
-field in a \fBpcre_extra()\fP block is used to pass this data, as described in
-the
+now pass a similar pointer to \fBpcre_exec()\fP, because the value saved with
+the compiled pattern will obviously be nonsense. A field in a
+\fBpcre_extra()\fP block is used to pass this data, as described in the
 .\" HTML <a href="pcreapi.html#extradata">
 .\" </a>
 section on matching a pattern
@@ -110,33 +107,19 @@
 \fBpcre_extra\fP data block and set the \fIstudy_data\fP field to point to the
 reloaded study data. You must also set the PCRE_EXTRA_STUDY_DATA bit in the
 \fIflags\fP field to indicate that study data is present. Then pass the
-\fBpcre_extra\fP block to \fBpcre_exec()\fP or \fBpcre_dfa_exec()\fP in the
-usual way.
+\fBpcre_extra\fP block to \fBpcre_exec()\fP in the usual way.
 .
 .
 .SH "COMPATIBILITY WITH DIFFERENT PCRE RELEASES"
 .rs
 .sp
-In general, it is safest to recompile all saved patterns when you update to a
-new PCRE release, though not all updates actually require this. Recompiling is
-definitely needed for release 7.2.
-.
-.
-.
-.SH AUTHOR
-.rs
-.sp
-.nf
-Philip Hazel
-University Computing Service
-Cambridge CB2 3QH, England.
-.fi
-.
-.
-.SH REVISION
-.rs
-.sp
-.nf
-Last updated: 13 June 2007
-Copyright (c) 1997-2007 University of Cambridge.
-.fi
+The layout of the control block that is at the start of the data that makes up
+a compiled pattern was changed for release 5.0. If you have any saved patterns
+that were compiled with previous releases (not a facility that was previously
+advertised), you will have to recompile them for release 5.0. However, from now
+on, it should be possible to make changes in a compabible manner.
+.P
+.in 0
+Last updated: 10 September 2004
+.br
+Copyright (c) 1997-2004 University of Cambridge.



Mime
View raw message