/[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 92 by nigel, Sat Feb 24 21:41:34 2007 UTC revision 93 by nigel, Sat Feb 24 21:41:42 2007 UTC
# Line 24  documentation. Line 24  documentation.
24  .SH OPTIONS  .SH OPTIONS
25  .rs  .rs
26  .TP 10  .TP 10
27    \fB-b\fP
28    Behave as if each regex has the \fB/B\fP (show bytecode) modifier; the internal
29    form is output after compilation.
30    .TP 10
31  \fB-C\fP  \fB-C\fP
32  Output the version number of the PCRE library, and all available information  Output the version number of the PCRE library, and all available information
33  about the optional features that are included, and then exit.  about the optional features that are included, and then exit.
34  .TP 10  .TP 10
35  \fB-d\fP  \fB-d\fP
36  Behave as if each regex has the \fB/D\fP (debug) modifier; the internal  Behave as if each regex has the \fB/D\fP (debug) modifier; the internal
37  form is output after compilation.  form and information about the compiled pattern is output after compilation;
38    \fB-d\fP is equivalent to \fB-b -i\fP.
39  .TP 10  .TP 10
40  \fB-dfa\fP  \fB-dfa\fP
41  Behave as if each data line contains the \eD escape sequence; this causes the  Behave as if each data line contains the \eD escape sequence; this causes the
42  alternative matching function, \fBpcre_dfa_exec()\fP, to be used instead of the  alternative matching function, \fBpcre_dfa_exec()\fP, to be used instead of the
43  standard \fBpcre_exec()\fP function (more detail is given below).  standard \fBpcre_exec()\fP function (more detail is given below).
44  .TP 10  .TP 10
45    \fB-help\fP
46    Output a brief summary these options and then exit.
47    .TP 10
48  \fB-i\fP  \fB-i\fP
49  Behave as if each regex has the \fB/I\fP modifier; information about the  Behave as if each regex has the \fB/I\fP modifier; information about the
50  compiled pattern is given after compilation.  compiled pattern is given after compilation.
# Line 48  with earlier versions of pcretest, \fB-s Line 56  with earlier versions of pcretest, \fB-s
56  .TP 10  .TP 10
57  \fB-o\fP \fIosize\fP  \fB-o\fP \fIosize\fP
58  Set the number of elements in the output vector that is used when calling  Set the number of elements in the output vector that is used when calling
59  \fBpcre_exec()\fP to be \fIosize\fP. The default value is 45, which is enough  \fBpcre_exec()\fP or \fBpcre_dfa_exec()\fP to be \fIosize\fP. The default value
60  for 14 capturing subexpressions. The vector size can be changed for individual  is 45, which is enough for 14 capturing subexpressions for \fBpcre_exec()\fP or
61  matching calls by including \eO in the data line (see below).  22 different matches for \fBpcre_dfa_exec()\fP. The vector size can be
62    changed for individual matching calls by including \eO in the data line (see
63    below).
64  .TP 10  .TP 10
65  \fB-p\fP  \fB-p\fP
66  Behave as if each regex has the \fB/P\fP modifier; the POSIX wrapper API is  Behave as if each regex has the \fB/P\fP modifier; the POSIX wrapper API is
# Line 68  megabytes. Line 78  megabytes.
78  Run each compile, study, and match many times with a timer, and output  Run each compile, study, and match many times with a timer, and output
79  resulting time per compile or match (in milliseconds). Do not set \fB-m\fP with  resulting time per compile or match (in milliseconds). Do not set \fB-m\fP with
80  \fB-t\fP, because you will then get the size output a zillion times, and the  \fB-t\fP, because you will then get the size output a zillion times, and the
81  timing will be distorted.  timing will be distorted. You can control the number of iterations that are
82    used for timing by following \fB-t\fP with a number (as a separate item on the
83    command line). For example, "-t 1000" would iterate 1000 times. The default is
84    to iterate 500000 times.
85    .TP 10
86    \fB-tm\fP
87    This is like \fB-t\fP except that it times only the matching phase, not the
88    compile or study phases.
89  .  .
90  .  .
91  .SH DESCRIPTION  .SH DESCRIPTION
# Line 86  lines to be matched against the pattern. Line 103  lines to be matched against the pattern.
103  .P  .P
104  Each data line is matched separately and independently. If you want to do  Each data line is matched separately and independently. If you want to do
105  multi-line matches, you have to use the \en escape sequence (or \er or \er\en,  multi-line matches, you have to use the \en escape sequence (or \er or \er\en,
106  depending on the newline setting) in a single line of input to encode the  etc., depending on the newline setting) in a single line of input to encode the
107  newline characters. There is no limit on the length of data lines; the input  newline sequences. There is no limit on the length of data lines; the input
108  buffer is automatically extended if it is too small.  buffer is automatically extended if it is too small.
109  .P  .P
110  An empty line signals the end of the data lines, at which point a new regular  An empty line signals the end of the data lines, at which point a new regular
# Line 151  not correspond to anything in Perl: Line 168  not correspond to anything in Perl:
168    \fB/<cr>\fP    PCRE_NEWLINE_CR    \fB/<cr>\fP    PCRE_NEWLINE_CR
169    \fB/<lf>\fP    PCRE_NEWLINE_LF    \fB/<lf>\fP    PCRE_NEWLINE_LF
170    \fB/<crlf>\fP  PCRE_NEWLINE_CRLF    \fB/<crlf>\fP  PCRE_NEWLINE_CRLF
171      \fB/<any>\fP   PCRE_NEWLINE_ANY
172    .sp
173    Those specifying line ending sequencess are literal strings as shown. This
174    example sets multiline matching with CRLF as the line ending sequence:
175  .sp  .sp
176  Those specifying line endings are literal strings as shown. Details of the    /^abc/m<crlf>
177  meanings of these PCRE options are given in the  .sp
178    Details of the meanings of these PCRE options are given in the
179  .\" HREF  .\" HREF
180  \fBpcreapi\fP  \fBpcreapi\fP
181  .\"  .\"
# Line 191  matched the entire pattern, pcretest sho Line 213  matched the entire pattern, pcretest sho
213  the subject string. This is useful for tests where the subject contains  the subject string. This is useful for tests where the subject contains
214  multiple copies of the same substring.  multiple copies of the same substring.
215  .P  .P
216    The \fB/B\fP modifier is a debugging feature. It requests that \fBpcretest\fP
217    output a representation of the compiled byte code after compilation.
218    .P
219  The \fB/L\fP modifier must be followed directly by the name of a locale, for  The \fB/L\fP modifier must be followed directly by the name of a locale, for
220  example,  example,
221  .sp  .sp
# Line 207  compiled pattern (whether it is anchored Line 232  compiled pattern (whether it is anchored
232  so on). It does this by calling \fBpcre_fullinfo()\fP after compiling a  so on). It does this by calling \fBpcre_fullinfo()\fP after compiling a
233  pattern. If the pattern is studied, the results of that are also output.  pattern. If the pattern is studied, the results of that are also output.
234  .P  .P
235  The \fB/D\fP modifier is a PCRE debugging feature, which also assumes \fB/I\fP.  The \fB/D\fP modifier is a PCRE debugging feature, and is equivalent to
236  It causes the internal form of compiled regular expressions to be output after  \fB/BI\fP, that is, both the \fP/B\fP and the \fB/I\fP modifiers.
 compilation. If the pattern was studied, the information returned is also  
 output.  
237  .P  .P
238  The \fB/F\fP modifier causes \fBpcretest\fP to flip the byte order of the  The \fB/F\fP modifier causes \fBpcretest\fP to flip the byte order of the
239  fields in the compiled pattern that contain 2-byte and 4-byte numbers. This  fields in the compiled pattern that contain 2-byte and 4-byte numbers. This
# Line 254  complicated features of PCRE. If you are Line 277  complicated features of PCRE. If you are
277  expressions, you probably don't need any of these. The following escapes are  expressions, you probably don't need any of these. The following escapes are
278  recognized:  recognized:
279  .sp  .sp
280    \ea         alarm (= BEL)    \ea         alarm (BEL, \ex07)
281    \eb         backspace    \eb         backspace (\ex08)
282    \ee         escape    \ee         escape (\ex27)
283    \ef         formfeed    \ef         formfeed (\ex0c)
284    \en         newline    \en         newline (\ex0a)
285  .\" JOIN  .\" JOIN
286    \eqdd       set the PCRE_MATCH_LIMIT limit to dd    \eqdd       set the PCRE_MATCH_LIMIT limit to dd
287                 (any number of digits)                 (any number of digits)
288    \er         carriage return    \er         carriage return (\ex0d)
289    \et         tab    \et         tab (\ex09)
290    \ev         vertical tab    \ev         vertical tab (\ex0b)
291    \ennn       octal character (up to 3 octal digits)    \ennn       octal character (up to 3 octal digits)
292    \exhh       hexadecimal character (up to 2 hex digits)    \exhh       hexadecimal character (up to 2 hex digits)
293  .\" JOIN  .\" JOIN
# Line 344  recognized: Line 367  recognized:
367  .\" JOIN  .\" JOIN
368    \e<crlf>    pass the PCRE_NEWLINE_CRLF option to \fBpcre_exec()\fP    \e<crlf>    pass the PCRE_NEWLINE_CRLF option to \fBpcre_exec()\fP
369                 or \fBpcre_dfa_exec()\fP                 or \fBpcre_dfa_exec()\fP
370    .\" JOIN
371      \e<any>     pass the PCRE_NEWLINE_ANY option to \fBpcre_exec()\fP
372                   or \fBpcre_dfa_exec()\fP
373  .sp  .sp
374  The escapes that specify line endings are literal strings, exactly as shown.  The escapes that specify line ending sequences are literal strings, exactly as
375  A backslash followed by anything else just escapes the anything else. If the  shown. No more than one newline setting should be present in any data line.
376  very last character is a backslash, it is ignored. This gives a way of passing  .P
377  an empty line as data, since a real empty line terminates the data input.  A backslash followed by anything else just escapes the anything else. If
378    the very last character is a backslash, it is ignored. This gives a way of
379    passing an empty line as data, since a real empty line terminates the data
380    input.
381  .P  .P
382  If \eM is present, \fBpcretest\fP calls \fBpcre_exec()\fP several times, with  If \eM is present, \fBpcretest\fP calls \fBpcre_exec()\fP several times, with
383  different values in the \fImatch_limit\fP and \fImatch_limit_recursion\fP  different values in the \fImatch_limit\fP and \fImatch_limit_recursion\fP
# Line 411  respectively, and otherwise the PCRE neg Line 440  respectively, and otherwise the PCRE neg
440  of an interactive \fBpcretest\fP run.  of an interactive \fBpcretest\fP run.
441  .sp  .sp
442    $ pcretest    $ pcretest
443    PCRE version 5.00 07-Sep-2004    PCRE version 7.0 30-Nov-2006
444  .sp  .sp
445      re> /^abc(\ed+)/      re> /^abc(\ed+)/
446    data> abc123    data> abc123
# Line 422  of an interactive \fBpcretest\fP run. Line 451  of an interactive \fBpcretest\fP run.
451  .sp  .sp
452  If the strings contain any non-printing characters, they are output as \e0x  If the strings contain any non-printing characters, they are output as \e0x
453  escapes, or as \ex{...} escapes if the \fB/8\fP modifier was present on the  escapes, or as \ex{...} escapes if the \fB/8\fP modifier was present on the
454  pattern. If the pattern has the \fB/+\fP modifier, the output for substring 0  pattern. See below for the definition of non-printing characters. If the
455  is followed by the the rest of the subject string, identified by "0+" like  pattern has the \fB/+\fP modifier, the output for substring 0 is followed by
456  this:  the the rest of the subject string, identified by "0+" like this:
457  .sp  .sp
458      re> /cat/+      re> /cat/+
459    data> cataract    data> cataract
# Line 452  instead of a colon. This is in addition Line 481  instead of a colon. This is in addition
481  length (that is, the return from the extraction function) is given in  length (that is, the return from the extraction function) is given in
482  parentheses after each string for \fB\eC\fP and \fB\eG\fP.  parentheses after each string for \fB\eC\fP and \fB\eG\fP.
483  .P  .P
484  Note that while patterns can be continued over several lines (a plain ">"  Note that whereas patterns can be continued over several lines (a plain ">"
485  prompt is used for continuations), data lines may not. However newlines can be  prompt is used for continuations), data lines may not. However newlines can be
486  included in data by means of the \en escape (or \er or \er\en for those newline  included in data by means of the \en escape (or \er, \er\en, etc., depending on
487  settings).  the newline sequence setting).
488    .
489  .  .
490  .  .
491  .SH "OUTPUT FROM THE ALTERNATIVE MATCHING FUNCTION"  .SH "OUTPUT FROM THE ALTERNATIVE MATCHING FUNCTION"
# Line 475  the subject where there is at least one Line 505  the subject where there is at least one
505  (Using the normal matching function on this data finds only "tang".) The  (Using the normal matching function on this data finds only "tang".) The
506  longest matching string is always given first (and numbered zero).  longest matching string is always given first (and numbered zero).
507  .P  .P
508  If \fB/g\P 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
509  at the end of the longest match. For example:  at the end of the longest match. For example:
510  .sp  .sp
511      re> /(tang|tangerine|tan)/g      re> /(tang|tangerine|tan)/g
# Line 556  the Line 586  the
586  documentation.  documentation.
587  .  .
588  .  .
589    .
590    .SH "NON-PRINTING CHARACTERS"
591    .rs
592    .sp
593    When \fBpcretest\fP is outputting text in the compiled version of a pattern,
594    bytes other than 32-126 are always treated as non-printing characters are are
595    therefore shown as hex escapes.
596    .P
597    When \fBpcretest\fP is outputting text that is a matched part of a subject
598    string, it behaves in the same way, unless a different locale has been set for
599    the pattern (using the \fB/L\fP modifier). In this case, the \fBisprint()\fP
600    function to distinguish printing and non-printing characters.
601    .
602    .
603    .
604  .SH "SAVING AND RELOADING COMPILED PATTERNS"  .SH "SAVING AND RELOADING COMPILED PATTERNS"
605  .rs  .rs
606  .sp  .sp
# Line 616  Finally, if you attempt to load a file t Line 661  Finally, if you attempt to load a file t
661  result is undefined.  result is undefined.
662  .  .
663  .  .
664    .SH "SEE ALSO"
665    .rs
666    .sp
667    \fBpcre\fP(3), \fBpcreapi\fP(3), \fBpcrecallout\fP(3), \fBpcrematching\fP(3),
668    \fBpcrepartial\fP(d), \fPpcrepattern\fP(3), \fBpcreprecompile\fP(3).
669    .
670    .
671  .SH AUTHOR  .SH AUTHOR
672  .rs  .rs
673  .sp  .sp
# Line 623  Philip Hazel Line 675  Philip Hazel
675  .br  .br
676  University Computing Service,  University Computing Service,
677  .br  .br
678  Cambridge CB2 3QG, England.  Cambridge CB2 3QH, England.
679  .P  .P
680  .in 0  .in 0
681  Last updated: 29 June 2006  Last updated: 30 November 2006
682  .br  .br
683  Copyright (c) 1997-2006 University of Cambridge.  Copyright (c) 1997-2006 University of Cambridge.

Legend:
Removed from v.92  
changed lines
  Added in v.93

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12