/[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 570 by ph10, Sun Nov 7 16:25:12 2010 UTC revision 598 by ph10, Sat May 7 15:37:31 2011 UTC
# Line 179  options that do not correspond to anythi Line 179  options that do not correspond to anythi
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 221  empty string, the next call is done with Line 222  empty string, the next call is done with
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, and the  same point. If this second match fails, the start offset is advanced, and the
224  normal match is retried. This imitates the way Perl handles such cases when  normal match is retried. This imitates the way Perl handles such cases when
225  using the \fB/g\fP modifier or the \fBsplit()\fP function. Normally, the start  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  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  CRLF as a newline, and the current character is CR followed by LF, an advance
228  of two is used.  of two is used.
229  .  .
230  .  .
# Line 344  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                 always a byte unless > 255 in UTF-8 mode                 always a byte unless > 255 in UTF-8 mode
349    \exhh       hexadecimal byte (up to 2 hex digits)    \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
# Line 417  recognized: Line 418  recognized:
418                 \fBpcre_exec()\fP or \fBpcre_dfa_exec()\fP                 \fBpcre_exec()\fP or \fBpcre_dfa_exec()\fP
419  .\" JOIN  .\" JOIN
420    \e>dd       start the match at offset dd (optional "-"; then    \e>dd       start the match at offset dd (optional "-"; then
421                 any number of digits); this sets the \fIstartoffset\fP                 any number of digits); this sets the \fIstartoffset\fP
422                 argument for \fBpcre_exec()\fP or \fBpcre_dfa_exec()\fP                 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
# Line 435  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  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  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,  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  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  UTF-8 mode, it generates one byte for values less than 256, and causes an error
444  for greater values.  for greater values.
445  .P  .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
# Line 506  found. This is always the shortest possi Line 507  found. This is always the shortest possi
507  This section describes the output when the normal matching function,  This section describes the output when the normal matching function,
508  \fBpcre_exec()\fP, is being used.  \fBpcre_exec()\fP, is being used.
509  .P  .P
510  When a match succeeds, pcretest outputs the list of captured substrings that  When a match succeeds, \fBpcretest\fP outputs the list of captured substrings
511  \fBpcre_exec()\fP returns, starting with number 0 for the string that matched  that \fBpcre_exec()\fP returns, starting with number 0 for the string that
512  the whole pattern. Otherwise, it outputs "No match" when the return is  matched 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. (Note that this is  substring when \fBpcre_exec()\fP returns PCRE_ERROR_PARTIAL. (Note that this is
515  the entire substring that was inspected during the partial match; it may  the entire substring that was inspected during the partial match; it may
516  include characters before the actual match start if a lookbehind assertion,  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  \eK, \eb, or \eB was involved.) For any other return, \fBpcretest\fP outputs
518  negative error number. Here is an example of an interactive \fBpcretest\fP run.  the PCRE negative error number and a short descriptive phrase. If the error is
519    a failed UTF-8 string check, the byte offset of the start of the failing
520    character and the reason code are also output, provided that the size of the
521    output vector is at least two. Here is an example of an interactive
522    \fBpcretest\fP run.
523  .sp  .sp
524    $ pcretest    $ pcretest
525    PCRE version 7.0 30-Nov-2006    PCRE version 8.13 2011-04-30
526  .sp  .sp
527      re> /^abc(\ed+)/      re> /^abc(\ed+)/
528    data> abc123    data> abc123
# Line 526  negative error number. Here is an exampl Line 531  negative error number. Here is an exampl
531    data> xyz    data> xyz
532    No match    No match
533  .sp  .sp
534  Note that unset capturing substrings that are not followed by one that is set  Unset capturing substrings that are not followed by one that is set are not
535  are not returned by \fBpcre_exec()\fP, and are not shown by \fBpcretest\fP. In  returned by \fBpcre_exec()\fP, and are not shown by \fBpcretest\fP. In the
536  the following example, there are two capturing substrings, but when the first  following example, there are two capturing substrings, but when the first data
537  data line is matched, the second, unset substring is not shown. An "internal"  line is matched, the second, unset substring is not shown. An "internal" unset
538  unset substring is shown as "<unset>", as for the second data line.  substring is shown as "<unset>", as for the second data line.
539  .sp  .sp
540      re> /(a)|(b)/      re> /(a)|(b)/
541    data> a    data> a
# Line 564  matching attempts are output in sequence Line 569  matching attempts are output in sequence
569     0: ipp     0: ipp
570     1: pp     1: pp
571  .sp  .sp
572  "No match" is output only if the first match attempt fails.  "No match" is output only if the first match attempt fails. Here is an example
573    of a failure message (the offset 4 that is specified by \e>4 is past the end of
574    the subject string):
575    .sp
576        re> /xyz/
577      data> xyz\>4
578      Error -24 (bad offset value)
579  .P  .P
580  If any of the sequences \fB\eC\fP, \fB\eG\fP, or \fB\eL\fP are present in a  If any of the sequences \fB\eC\fP, \fB\eG\fP, or \fB\eL\fP are present in a
581  data line that is successfully matched, the substrings extracted by the  data line that is successfully matched, the substrings extracted by the
# Line 778  Cambridge CB2 3QH, England. Line 789  Cambridge CB2 3QH, England.
789  .rs  .rs
790  .sp  .sp
791  .nf  .nf
792  Last updated: 07 November 2010  Last updated: 06 May 2011
793  Copyright (c) 1997-2010 University of Cambridge.  Copyright (c) 1997-2011 University of Cambridge.
794  .fi  .fi

Legend:
Removed from v.570  
changed lines
  Added in v.598

  ViewVC Help
Powered by ViewVC 1.1.5