/[pcre]/code/trunk/doc/pcrepattern.3
ViewVC logotype

Diff of /code/trunk/doc/pcrepattern.3

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 259 by ph10, Wed Sep 19 09:52:44 2007 UTC revision 333 by ph10, Thu Apr 10 19:55:57 2008 UTC
# Line 9  are described in detail below. There is Line 9  are described in detail below. There is
9  .\" HREF  .\" HREF
10  \fBpcresyntax\fP  \fBpcresyntax\fP
11  .\"  .\"
12  page. Perl's regular expressions are described in its own documentation, and  page. PCRE tries to match Perl syntax and semantics as closely as it can. PCRE
13    also supports some alternative regular expression syntax (which does not
14    conflict with the Perl syntax) in order to provide some compatibility with
15    regular expressions in Python, .NET, and Oniguruma.
16    .P
17    Perl's regular expressions are described in its own documentation, and
18  regular expressions in general are covered in a number of books, some of which  regular expressions in general are covered in a number of books, some of which
19  have copious examples. Jeffrey Friedl's "Mastering Regular Expressions",  have copious examples. Jeffrey Friedl's "Mastering Regular Expressions",
20  published by O'Reilly, covers regular expressions in great detail. This  published by O'Reilly, covers regular expressions in great detail. This
# Line 310  parenthesized subpatterns. Line 315  parenthesized subpatterns.
315  .\"  .\"
316  .  .
317  .  .
318    .SS "Absolute and relative subroutine calls"
319    .rs
320    .sp
321    For compatibility with Oniguruma, the non-Perl syntax \eg followed by a name or
322    a number enclosed either in angle brackets or single quotes, is an alternative
323    syntax for referencing a subpattern as a "subroutine". Details are discussed
324    .\" HTML <a href="#onigurumasubroutines">
325    .\" </a>
326    later.
327    .\"
328    Note that \eg{...} (Perl syntax) and \eg<...> (Oniguruma syntax) are \fInot\fP
329    synonymous. The former is a back reference; the latter is a subroutine call.
330    .
331    .
332  .SS "Generic character types"  .SS "Generic character types"
333  .rs  .rs
334  .sp  .sp
# Line 2023  It matches "abcabc". It does not match " Line 2042  It matches "abcabc". It does not match "
2042  processing option does not affect the called subpattern.  processing option does not affect the called subpattern.
2043  .  .
2044  .  .
2045    .\" HTML <a name="onigurumasubroutines"></a>
2046    .SH "ONIGURUMA SUBROUTINE SYNTAX"
2047    .rs
2048    .sp
2049    For compatibility with Oniguruma, the non-Perl syntax \eg followed by a name or
2050    a number enclosed either in angle brackets or single quotes, is an alternative
2051    syntax for referencing a subpattern as a subroutine, possibly recursively. Here
2052    are two of the examples used above, rewritten using this syntax:
2053    .sp
2054      (?<pn> \e( ( (?>[^()]+) | \eg<pn> )* \e) )
2055      (sens|respons)e and \eg'1'ibility
2056    .sp
2057    PCRE supports an extension to Oniguruma: if a number is preceded by a
2058    plus or a minus sign it is taken as a relative reference. For example:
2059    .sp
2060      (abc)(?i:\eg<-1>)
2061    .sp
2062    Note that \eg{...} (Perl syntax) and \eg<...> (Oniguruma syntax) are \fInot\fP
2063    synonymous. The former is a back reference; the latter is a subroutine call.
2064    .
2065    .
2066  .SH CALLOUTS  .SH CALLOUTS
2067  .rs  .rs
2068  .sp  .sp
# Line 2192  Cambridge CB2 3QH, England. Line 2232  Cambridge CB2 3QH, England.
2232  .rs  .rs
2233  .sp  .sp
2234  .nf  .nf
2235  Last updated: 17 September 2007  Last updated: 10 April 2008
2236  Copyright (c) 1997-2007 University of Cambridge.  Copyright (c) 1997-2008 University of Cambridge.
2237  .fi  .fi

Legend:
Removed from v.259  
changed lines
  Added in v.333

  ViewVC Help
Powered by ViewVC 1.1.5