--- code/trunk/doc/pcretest.1 2007/02/24 21:41:36 92 +++ code/trunk/doc/pcretest.1 2007/02/24 21:41:42 93 @@ -24,19 +24,27 @@ .SH OPTIONS .rs .TP 10 +\fB-b\fP +Behave as if each regex has the \fB/B\fP (show bytecode) modifier; the internal +form is output after compilation. +.TP 10 \fB-C\fP Output the version number of the PCRE library, and all available information about the optional features that are included, and then exit. .TP 10 \fB-d\fP Behave as if each regex has the \fB/D\fP (debug) modifier; the internal -form is output after compilation. +form and information about the compiled pattern is output after compilation; +\fB-d\fP is equivalent to \fB-b -i\fP. .TP 10 \fB-dfa\fP Behave as if each data line contains the \eD escape sequence; this causes the alternative matching function, \fBpcre_dfa_exec()\fP, to be used instead of the standard \fBpcre_exec()\fP function (more detail is given below). .TP 10 +\fB-help\fP +Output a brief summary these options and then exit. +.TP 10 \fB-i\fP Behave as if each regex has the \fB/I\fP modifier; information about the compiled pattern is given after compilation. @@ -48,9 +56,11 @@ .TP 10 \fB-o\fP \fIosize\fP Set the number of elements in the output vector that is used when calling -\fBpcre_exec()\fP to be \fIosize\fP. The default value is 45, which is enough -for 14 capturing subexpressions. The vector size can be changed for individual -matching calls by including \eO in the data line (see below). +\fBpcre_exec()\fP or \fBpcre_dfa_exec()\fP to be \fIosize\fP. The default value +is 45, which is enough for 14 capturing subexpressions for \fBpcre_exec()\fP or +22 different matches for \fBpcre_dfa_exec()\fP. The vector size can be +changed for individual matching calls by including \eO in the data line (see +below). .TP 10 \fB-p\fP Behave as if each regex has the \fB/P\fP modifier; the POSIX wrapper API is @@ -68,7 +78,14 @@ Run each compile, study, and match many times with a timer, and output resulting time per compile or match (in milliseconds). Do not set \fB-m\fP with \fB-t\fP, because you will then get the size output a zillion times, and the -timing will be distorted. +timing will be distorted. You can control the number of iterations that are +used for timing by following \fB-t\fP with a number (as a separate item on the +command line). For example, "-t 1000" would iterate 1000 times. The default is +to iterate 500000 times. +.TP 10 +\fB-tm\fP +This is like \fB-t\fP except that it times only the matching phase, not the +compile or study phases. . . .SH DESCRIPTION @@ -86,8 +103,8 @@ .P Each data line is matched separately and independently. If you want to do multi-line matches, you have to use the \en escape sequence (or \er or \er\en, -depending on the newline setting) in a single line of input to encode the -newline characters. There is no limit on the length of data lines; the input +etc., depending on the newline setting) in a single line of input to encode the +newline sequences. There is no limit on the length of data lines; the input buffer is automatically extended if it is too small. .P An empty line signals the end of the data lines, at which point a new regular @@ -151,9 +168,14 @@ \fB/\fP PCRE_NEWLINE_CR \fB/\fP PCRE_NEWLINE_LF \fB/\fP PCRE_NEWLINE_CRLF + \fB/\fP PCRE_NEWLINE_ANY +.sp +Those specifying line ending sequencess are literal strings as shown. This +example sets multiline matching with CRLF as the line ending sequence: .sp -Those specifying line endings are literal strings as shown. Details of the -meanings of these PCRE options are given in the + /^abc/m +.sp +Details of the meanings of these PCRE options are given in the .\" HREF \fBpcreapi\fP .\" @@ -191,6 +213,9 @@ the subject string. This is useful for tests where the subject contains multiple copies of the same substring. .P +The \fB/B\fP modifier is a debugging feature. It requests that \fBpcretest\fP +output a representation of the compiled byte code after compilation. +.P The \fB/L\fP modifier must be followed directly by the name of a locale, for example, .sp @@ -207,10 +232,8 @@ so on). It does this by calling \fBpcre_fullinfo()\fP after compiling a pattern. If the pattern is studied, the results of that are also output. .P -The \fB/D\fP modifier is a PCRE debugging feature, which also assumes \fB/I\fP. -It causes the internal form of compiled regular expressions to be output after -compilation. If the pattern was studied, the information returned is also -output. +The \fB/D\fP modifier is a PCRE debugging feature, and is equivalent to +\fB/BI\fP, that is, both the \fP/B\fP and the \fB/I\fP modifiers. .P The \fB/F\fP modifier causes \fBpcretest\fP to flip the byte order of the fields in the compiled pattern that contain 2-byte and 4-byte numbers. This @@ -254,17 +277,17 @@ expressions, you probably don't need any of these. The following escapes are recognized: .sp - \ea alarm (= BEL) - \eb backspace - \ee escape - \ef formfeed - \en newline + \ea alarm (BEL, \ex07) + \eb backspace (\ex08) + \ee escape (\ex27) + \ef formfeed (\ex0c) + \en newline (\ex0a) .\" JOIN \eqdd set the PCRE_MATCH_LIMIT limit to dd (any number of digits) - \er carriage return - \et tab - \ev vertical tab + \er carriage return (\ex0d) + \et tab (\ex09) + \ev vertical tab (\ex0b) \ennn octal character (up to 3 octal digits) \exhh hexadecimal character (up to 2 hex digits) .\" JOIN @@ -344,11 +367,17 @@ .\" JOIN \e pass the PCRE_NEWLINE_CRLF option to \fBpcre_exec()\fP or \fBpcre_dfa_exec()\fP +.\" JOIN + \e pass the PCRE_NEWLINE_ANY option to \fBpcre_exec()\fP + or \fBpcre_dfa_exec()\fP .sp -The escapes that specify line endings are literal strings, exactly as shown. -A backslash followed by anything else just escapes the anything else. If the -very last character is a backslash, it is ignored. This gives a way of passing -an empty line as data, since a real empty line terminates the data input. +The escapes that specify line ending sequences are literal strings, exactly as +shown. No more than one newline setting should be present in any data line. +.P +A backslash followed by anything else just escapes the anything else. If +the very last character is a backslash, it is ignored. This gives a way of +passing an empty line as data, since a real empty line terminates the data +input. .P If \eM is present, \fBpcretest\fP calls \fBpcre_exec()\fP several times, with different values in the \fImatch_limit\fP and \fImatch_limit_recursion\fP @@ -411,7 +440,7 @@ of an interactive \fBpcretest\fP run. .sp $ pcretest - PCRE version 5.00 07-Sep-2004 + PCRE version 7.0 30-Nov-2006 .sp re> /^abc(\ed+)/ data> abc123 @@ -422,9 +451,9 @@ .sp If the strings contain any non-printing characters, they are output as \e0x escapes, or as \ex{...} escapes if the \fB/8\fP modifier was present on the -pattern. If the pattern has the \fB/+\fP modifier, the output for substring 0 -is followed by the the rest of the subject string, identified by "0+" like -this: +pattern. See below for the definition of non-printing characters. If the +pattern has the \fB/+\fP modifier, the output for substring 0 is followed by +the the rest of the subject string, identified by "0+" like this: .sp re> /cat/+ data> cataract @@ -452,10 +481,11 @@ length (that is, the return from the extraction function) is given in parentheses after each string for \fB\eC\fP and \fB\eG\fP. .P -Note that while patterns can be continued over several lines (a plain ">" +Note that whereas patterns can be continued over several lines (a plain ">" prompt is used for continuations), data lines may not. However newlines can be -included in data by means of the \en escape (or \er or \er\en for those newline -settings). +included in data by means of the \en escape (or \er, \er\en, etc., depending on +the newline sequence setting). +. . . .SH "OUTPUT FROM THE ALTERNATIVE MATCHING FUNCTION" @@ -475,7 +505,7 @@ (Using the normal matching function on this data finds only "tang".) The longest matching string is always given first (and numbered zero). .P -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 at the end of the longest match. For example: .sp re> /(tang|tangerine|tan)/g @@ -556,6 +586,21 @@ documentation. . . +. +.SH "NON-PRINTING CHARACTERS" +.rs +.sp +When \fBpcretest\fP is outputting text in the compiled version of a pattern, +bytes other than 32-126 are always treated as non-printing characters are are +therefore shown as hex escapes. +.P +When \fBpcretest\fP is outputting text that is a matched part of a subject +string, it behaves in the same way, unless a different locale has been set for +the pattern (using the \fB/L\fP modifier). In this case, the \fBisprint()\fP +function to distinguish printing and non-printing characters. +. +. +. .SH "SAVING AND RELOADING COMPILED PATTERNS" .rs .sp @@ -616,6 +661,13 @@ result is undefined. . . +.SH "SEE ALSO" +.rs +.sp +\fBpcre\fP(3), \fBpcreapi\fP(3), \fBpcrecallout\fP(3), \fBpcrematching\fP(3), +\fBpcrepartial\fP(d), \fPpcrepattern\fP(3), \fBpcreprecompile\fP(3). +. +. .SH AUTHOR .rs .sp @@ -623,9 +675,9 @@ .br University Computing Service, .br -Cambridge CB2 3QG, England. +Cambridge CB2 3QH, England. .P .in 0 -Last updated: 29 June 2006 +Last updated: 30 November 2006 .br Copyright (c) 1997-2006 University of Cambridge.