/[pcre]/code/trunk/doc/pcretest.1
ViewVC logotype

Diff of /code/trunk/doc/pcretest.1

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

revision 518 by ph10, Tue May 18 15:47:01 2010 UTC revision 576 by ph10, Sun Nov 21 18:45:10 2010 UTC
# Line 169  The following table shows additional mod Line 169  The following table shows additional mod
169  options that do not correspond to anything in Perl:  options that do not correspond to anything in Perl:
170  .sp  .sp
171    \fB/8\fP              PCRE_UTF8    \fB/8\fP              PCRE_UTF8
172    \fB/?\fP              PCRE_NO_UTF8_CHECK    \fB/?\fP              PCRE_NO_UTF8_CHECK
173    \fB/A\fP              PCRE_ANCHORED    \fB/A\fP              PCRE_ANCHORED
174    \fB/C\fP              PCRE_AUTO_CALLOUT    \fB/C\fP              PCRE_AUTO_CALLOUT
175    \fB/E\fP              PCRE_DOLLAR_ENDONLY    \fB/E\fP              PCRE_DOLLAR_ENDONLY
# Line 177  options that do not correspond to anythi Line 177  options that do not correspond to anythi
177    \fB/J\fP              PCRE_DUPNAMES    \fB/J\fP              PCRE_DUPNAMES
178    \fB/N\fP              PCRE_NO_AUTO_CAPTURE    \fB/N\fP              PCRE_NO_AUTO_CAPTURE
179    \fB/U\fP              PCRE_UNGREEDY    \fB/U\fP              PCRE_UNGREEDY
180    \fB/W\fP              PCRE_UCP    \fB/W\fP              PCRE_UCP
181    \fB/X\fP              PCRE_EXTRA    \fB/X\fP              PCRE_EXTRA
182      \fB/Y\fP              PCRE_NO_START_OPTIMIZE
183    \fB/<JS>\fP           PCRE_JAVASCRIPT_COMPAT    \fB/<JS>\fP           PCRE_JAVASCRIPT_COMPAT
184    \fB/<cr>\fP           PCRE_NEWLINE_CR    \fB/<cr>\fP           PCRE_NEWLINE_CR
185    \fB/<lf>\fP           PCRE_NEWLINE_LF    \fB/<lf>\fP           PCRE_NEWLINE_LF
# Line 201  options are given in the Line 202  options are given in the
202  .\" HREF  .\" HREF
203  \fBpcreapi\fP  \fBpcreapi\fP
204  .\"  .\"
205  documentation.  documentation.
206  .  .
207  .  .
208  .SS "Finding all matches in a string"  .SS "Finding all matches in a string"
# Line 219  begins with a lookbehind assertion (incl Line 220  begins with a lookbehind assertion (incl
220  If any call to \fBpcre_exec()\fP in a \fB/g\fP or \fB/G\fP sequence matches an  If any call to \fBpcre_exec()\fP in a \fB/g\fP or \fB/G\fP sequence matches an
221  empty string, the next call is done with the PCRE_NOTEMPTY_ATSTART and  empty string, the next call is done with the PCRE_NOTEMPTY_ATSTART and
222  PCRE_ANCHORED flags set in order to search for another, non-empty, match at the  PCRE_ANCHORED flags set in order to search for another, non-empty, match at the
223  same point. If this second match fails, the start offset is advanced by one  same point. If this second match fails, the start offset is advanced, and the
224  character, and the normal match is retried. This imitates the way Perl handles  normal match is retried. This imitates the way Perl handles such cases when
225  such cases when using the \fB/g\fP modifier or the \fBsplit()\fP function.  using the \fB/g\fP modifier or the \fBsplit()\fP function. Normally, the start
226    offset is advanced by one character, but if the newline convention recognizes
227    CRLF as a newline, and the current character is CR followed by LF, an advance
228    of two is used.
229  .  .
230  .  .
231  .SS "Other modifiers"  .SS "Other modifiers"
# Line 276  example, Line 280  example,
280  For this reason, it must be the last modifier. The given locale is set,  For this reason, it must be the last modifier. The given locale is set,
281  \fBpcre_maketables()\fP is called to build a set of character tables for the  \fBpcre_maketables()\fP is called to build a set of character tables for the
282  locale, and this is then passed to \fBpcre_compile()\fP when compiling the  locale, and this is then passed to \fBpcre_compile()\fP when compiling the
283  regular expression. Without an \fB/L\fP modifier, NULL is passed as the tables  regular expression. Without an \fB/L\fP (or \fB/T\fP) modifier, NULL is passed
284  pointer; that is, \fB/L\fP applies only to the expression on which it appears.  as the tables pointer; that is, \fB/L\fP applies only to the expression on
285    which it appears.
286  .P  .P
287  The \fB/M\fP modifier causes the size of memory block used to hold the compiled  The \fB/M\fP modifier causes the size of memory block used to hold the compiled
288  pattern to be output.  pattern to be output.
# Line 285  pattern to be output. Line 290  pattern to be output.
290  The \fB/S\fP modifier causes \fBpcre_study()\fP to be called after the  The \fB/S\fP modifier causes \fBpcre_study()\fP to be called after the
291  expression has been compiled, and the results used when the expression is  expression has been compiled, and the results used when the expression is
292  matched.  matched.
293    .P
294    The \fB/T\fP modifier must be followed by a single digit. It causes a specific
295    set of built-in character tables to be passed to \fBpcre_compile()\fP. It is
296    used in the standard PCRE tests to check behaviour with different character
297    tables. The digit specifies the tables as follows:
298    .sp
299      0   the default ASCII tables, as distributed in
300            pcre_chartables.c.dist
301      1   a set of tables defining ISO 8859 characters
302    .sp
303    In table 1, some characters whose codes are greater than 128 are identified as
304    letters, digits, spaces, etc.
305  .  .
306  .  .
307  .SS "Using the POSIX wrapper API"  .SS "Using the POSIX wrapper API"
308  .rs  .rs
309  .sp  .sp
310  The \fB/P\fP modifier causes \fBpcretest\fP to call PCRE via the POSIX wrapper  The \fB/P\fP modifier causes \fBpcretest\fP to call PCRE via the POSIX wrapper
311  API rather than its native API. When \fB/P\fP is set, the following modifiers  API rather than its native API. When \fB/P\fP is set, the following modifiers
312  set options for the \fBregcomp()\fP function:  set options for the \fBregcomp()\fP function:
313  .sp  .sp
314    /i    REG_ICASE    /i    REG_ICASE
315    /m    REG_NEWLINE    /m    REG_NEWLINE
316    /N    REG_NOSUB    /N    REG_NOSUB
317    /s    REG_DOTALL     )    /s    REG_DOTALL     )
318    /U    REG_UNGREEDY   ) These options are not part of    /U    REG_UNGREEDY   ) These options are not part of
319    /W    REG_UCP        )   the POSIX standard    /W    REG_UCP        )   the POSIX standard
320    /8    REG_UTF8       )    /8    REG_UTF8       )
321  .sp  .sp
# Line 328  recognized: Line 345  recognized:
345    \et         tab (\ex09)    \et         tab (\ex09)
346    \ev         vertical tab (\ex0b)    \ev         vertical tab (\ex0b)
347    \ennn       octal character (up to 3 octal digits)    \ennn       octal character (up to 3 octal digits)
348    \exhh       hexadecimal character (up to 2 hex digits)                 always a byte unless > 255 in UTF-8 mode
349      \exhh       hexadecimal byte (up to 2 hex digits)
350  .\" JOIN  .\" JOIN
351    \ex{hh...}  hexadecimal character, any number of digits    \ex{hh...}  hexadecimal character, any number of digits
352                 in UTF-8 mode                 in UTF-8 mode
# Line 398  recognized: Line 416  recognized:
416  .\" JOIN  .\" JOIN
417    \e?         pass the PCRE_NO_UTF8_CHECK option to    \e?         pass the PCRE_NO_UTF8_CHECK option to
418                 \fBpcre_exec()\fP or \fBpcre_dfa_exec()\fP                 \fBpcre_exec()\fP or \fBpcre_dfa_exec()\fP
   \e>dd       start the match at offset dd (any number of digits);  
419  .\" JOIN  .\" JOIN
420                 this sets the \fIstartoffset\fP argument for \fBpcre_exec()\fP    \e>dd       start the match at offset dd (optional "-"; then
421                 or \fBpcre_dfa_exec()\fP                 any number of digits); this sets the \fIstartoffset\fP
422                   argument for \fBpcre_exec()\fP or \fBpcre_dfa_exec()\fP
423  .\" JOIN  .\" JOIN
424    \e<cr>      pass the PCRE_NEWLINE_CR option to \fBpcre_exec()\fP    \e<cr>      pass the PCRE_NEWLINE_CR option to \fBpcre_exec()\fP
425                 or \fBpcre_dfa_exec()\fP                 or \fBpcre_dfa_exec()\fP
# Line 418  recognized: Line 436  recognized:
436    \e<any>     pass the PCRE_NEWLINE_ANY option to \fBpcre_exec()\fP    \e<any>     pass the PCRE_NEWLINE_ANY option to \fBpcre_exec()\fP
437                 or \fBpcre_dfa_exec()\fP                 or \fBpcre_dfa_exec()\fP
438  .sp  .sp
439    Note that \exhh always specifies one byte, even in UTF-8 mode; this makes it
440    possible to construct invalid UTF-8 sequences for testing purposes. On the
441    other hand, \ex{hh} is interpreted as a UTF-8 character in UTF-8 mode,
442    generating more than one byte if the value is greater than 127. When not in
443    UTF-8 mode, it generates one byte for values less than 256, and causes an error
444    for greater values.
445    .P
446  The escapes that specify line ending sequences are literal strings, exactly as  The escapes that specify line ending sequences are literal strings, exactly as
447  shown. No more than one newline setting should be present in any data line.  shown. No more than one newline setting should be present in any data line.
448  .P  .P
# Line 486  When a match succeeds, pcretest outputs Line 511  When a match succeeds, pcretest outputs
511  \fBpcre_exec()\fP returns, starting with number 0 for the string that matched  \fBpcre_exec()\fP returns, starting with number 0 for the string that matched
512  the whole pattern. Otherwise, it outputs "No match" when the return is  the whole pattern. Otherwise, it outputs "No match" when the return is
513  PCRE_ERROR_NOMATCH, and "Partial match:" followed by the partially matching  PCRE_ERROR_NOMATCH, and "Partial match:" followed by the partially matching
514  substring when \fBpcre_exec()\fP returns PCRE_ERROR_PARTIAL. For any other  substring when \fBpcre_exec()\fP returns PCRE_ERROR_PARTIAL. (Note that this is
515  returns, it outputs the PCRE negative error number. Here is an example of an  the entire substring that was inspected during the partial match; it may
516  interactive \fBpcretest\fP run.  include characters before the actual match start if a lookbehind assertion,
517    \eK, \eb, or \eB was involved.) For any other returns, it outputs the PCRE
518    negative error number. Here is an example of an interactive \fBpcretest\fP run.
519  .sp  .sp
520    $ pcretest    $ pcretest
521    PCRE version 7.0 30-Nov-2006    PCRE version 7.0 30-Nov-2006
# Line 571  the subject where there is at least one Line 598  the subject where there is at least one
598  (Using the normal matching function on this data finds only "tang".) The  (Using the normal matching function on this data finds only "tang".) The
599  longest matching string is always given first (and numbered zero). After a  longest matching string is always given first (and numbered zero). After a
600  PCRE_ERROR_PARTIAL return, the output is "Partial match:", followed by the  PCRE_ERROR_PARTIAL return, the output is "Partial match:", followed by the
601  partially matching substring.  partially matching substring. (Note that this is the entire substring that was
602    inspected during the partial match; it may include characters before the actual
603    match start if a lookbehind assertion, \eK, \eb, or \eB was involved.)
604  .P  .P
605  If \fB/g\fP is present on the pattern, the search for further matches resumes  If \fB/g\fP is present on the pattern, the search for further matches resumes
606  at the end of the longest match. For example:  at the end of the longest match. For example:
# Line 750  Cambridge CB2 3QH, England. Line 779  Cambridge CB2 3QH, England.
779  .rs  .rs
780  .sp  .sp
781  .nf  .nf
782  Last updated: 16 May 2010  Last updated: 21 November 2010
783  Copyright (c) 1997-2010 University of Cambridge.  Copyright (c) 1997-2010 University of Cambridge.
784  .fi  .fi

Legend:
Removed from v.518  
changed lines
  Added in v.576

  ViewVC Help
Powered by ViewVC 1.1.5