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

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

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

revision 91 by nigel, Sat Feb 24 21:41:34 2007 UTC revision 99 by ph10, Tue Mar 6 12:27:42 2007 UTC
# Line 7  Line 7 
7  <p>  <p>
8  Return to the <a href="index.html">PCRE index page</a>.  Return to the <a href="index.html">PCRE index page</a>.
9  </p>  </p>
10  <p>  <p>
11  This page is part of the PCRE HTML documentation. It was generated automatically  This page is part of the PCRE HTML documentation. It was generated automatically
12  from the original man page. If there is any nonsense in it, please consult the  from the original man page. If there is any nonsense in it, please consult the
13  man page, in case the conversion went wrong.  man page, in case the conversion went wrong.
14  <br>  <br>
15  <ul>  <ul>
16  <li><a name="TOC1" href="#SEC1">SYNOPSIS</a>  <li><a name="TOC1" href="#SEC1">SYNOPSIS</a>
17  <li><a name="TOC2" href="#SEC2">OPTIONS</a>  <li><a name="TOC2" href="#SEC2">OPTIONS</a>
# Line 23  man page, in case the conversion went wr Line 23  man page, in case the conversion went wr
23  <li><a name="TOC8" href="#SEC8">OUTPUT FROM THE ALTERNATIVE MATCHING FUNCTION</a>  <li><a name="TOC8" href="#SEC8">OUTPUT FROM THE ALTERNATIVE MATCHING FUNCTION</a>
24  <li><a name="TOC9" href="#SEC9">RESTARTING AFTER A PARTIAL MATCH</a>  <li><a name="TOC9" href="#SEC9">RESTARTING AFTER A PARTIAL MATCH</a>
25  <li><a name="TOC10" href="#SEC10">CALLOUTS</a>  <li><a name="TOC10" href="#SEC10">CALLOUTS</a>
26  <li><a name="TOC11" href="#SEC11">SAVING AND RELOADING COMPILED PATTERNS</a>  <li><a name="TOC11" href="#SEC11">NON-PRINTING CHARACTERS</a>
27  <li><a name="TOC12" href="#SEC12">AUTHOR</a>  <li><a name="TOC12" href="#SEC12">SAVING AND RELOADING COMPILED PATTERNS</a>
28    <li><a name="TOC13" href="#SEC13">SEE ALSO</a>
29    <li><a name="TOC14" href="#SEC14">AUTHOR</a>
30    <li><a name="TOC15" href="#SEC15">REVISION</a>
31  </ul>  </ul>
32  <br><a name="SEC1" href="#TOC1">SYNOPSIS</a><br>  <br><a name="SEC1" href="#TOC1">SYNOPSIS</a><br>
33  <P>  <P>
# Line 43  documentation. Line 46  documentation.
46  </P>  </P>
47  <br><a name="SEC2" href="#TOC1">OPTIONS</a><br>  <br><a name="SEC2" href="#TOC1">OPTIONS</a><br>
48  <P>  <P>
49    <b>-b</b>
50    Behave as if each regex has the <b>/B</b> (show bytecode) modifier; the internal
51    form is output after compilation.
52    </P>
53    <P>
54  <b>-C</b>  <b>-C</b>
55  Output the version number of the PCRE library, and all available information  Output the version number of the PCRE library, and all available information
56  about the optional features that are included, and then exit.  about the optional features that are included, and then exit.
# Line 50  about the optional features that are inc Line 58  about the optional features that are inc
58  <P>  <P>
59  <b>-d</b>  <b>-d</b>
60  Behave as if each regex has the <b>/D</b> (debug) modifier; the internal  Behave as if each regex has the <b>/D</b> (debug) modifier; the internal
61  form is output after compilation.  form and information about the compiled pattern is output after compilation;
62    <b>-d</b> is equivalent to <b>-b -i</b>.
63  </P>  </P>
64  <P>  <P>
65  <b>-dfa</b>  <b>-dfa</b>
# Line 59  alternative matching function, <b>pcre_d Line 68  alternative matching function, <b>pcre_d
68  standard <b>pcre_exec()</b> function (more detail is given below).  standard <b>pcre_exec()</b> function (more detail is given below).
69  </P>  </P>
70  <P>  <P>
71    <b>-help</b>
72    Output a brief summary these options and then exit.
73    </P>
74    <P>
75  <b>-i</b>  <b>-i</b>
76  Behave as if each regex has the <b>/I</b> modifier; information about the  Behave as if each regex has the <b>/I</b> modifier; information about the
77  compiled pattern is given after compilation.  compiled pattern is given after compilation.
# Line 72  with earlier versions of pcretest, <b>-s Line 85  with earlier versions of pcretest, <b>-s
85  <P>  <P>
86  <b>-o</b> <i>osize</i>  <b>-o</b> <i>osize</i>
87  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
88  <b>pcre_exec()</b> to be <i>osize</i>. The default value is 45, which is enough  <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b> to be <i>osize</i>. The default value
89  for 14 capturing subexpressions. The vector size can be changed for individual  is 45, which is enough for 14 capturing subexpressions for <b>pcre_exec()</b> or
90  matching calls by including \O in the data line (see below).  22 different matches for <b>pcre_dfa_exec()</b>. The vector size can be
91    changed for individual matching calls by including \O in the data line (see
92    below).
93  </P>  </P>
94  <P>  <P>
95  <b>-p</b>  <b>-p</b>
# Line 96  megabytes. Line 111  megabytes.
111  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
112  resulting time per compile or match (in milliseconds). Do not set <b>-m</b> with  resulting time per compile or match (in milliseconds). Do not set <b>-m</b> with
113  <b>-t</b>, because you will then get the size output a zillion times, and the  <b>-t</b>, because you will then get the size output a zillion times, and the
114  timing will be distorted.  timing will be distorted. You can control the number of iterations that are
115    used for timing by following <b>-t</b> with a number (as a separate item on the
116    command line). For example, "-t 1000" would iterate 1000 times. The default is
117    to iterate 500000 times.
118    </P>
119    <P>
120    <b>-tm</b>
121    This is like <b>-t</b> except that it times only the matching phase, not the
122    compile or study phases.
123  </P>  </P>
124  <br><a name="SEC3" href="#TOC1">DESCRIPTION</a><br>  <br><a name="SEC3" href="#TOC1">DESCRIPTION</a><br>
125  <P>  <P>
# Line 114  lines to be matched against the pattern. Line 137  lines to be matched against the pattern.
137  <P>  <P>
138  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
139  multi-line matches, you have to use the \n escape sequence (or \r or \r\n,  multi-line matches, you have to use the \n escape sequence (or \r or \r\n,
140  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
141  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
142  buffer is automatically extended if it is too small.  buffer is automatically extended if it is too small.
143  </P>  </P>
144  <P>  <P>
# Line 179  not correspond to anything in Perl: Line 202  not correspond to anything in Perl:
202    <b>/&#60;cr&#62;</b>    PCRE_NEWLINE_CR    <b>/&#60;cr&#62;</b>    PCRE_NEWLINE_CR
203    <b>/&#60;lf&#62;</b>    PCRE_NEWLINE_LF    <b>/&#60;lf&#62;</b>    PCRE_NEWLINE_LF
204    <b>/&#60;crlf&#62;</b>  PCRE_NEWLINE_CRLF    <b>/&#60;crlf&#62;</b>  PCRE_NEWLINE_CRLF
205      <b>/&#60;any&#62;</b>   PCRE_NEWLINE_ANY
206    </pre>
207    Those specifying line ending sequencess are literal strings as shown. This
208    example sets multiline matching with CRLF as the line ending sequence:
209    <pre>
210      /^abc/m&#60;crlf&#62;
211  </pre>  </pre>
212  Those specifying line endings are literal strings as shown. Details of the  Details of the meanings of these PCRE options are given in the
 meanings of these PCRE options are given in the  
213  <a href="pcreapi.html"><b>pcreapi</b></a>  <a href="pcreapi.html"><b>pcreapi</b></a>
214  documentation.  documentation.
215  </P>  </P>
# Line 220  the subject string. This is useful for t Line 248  the subject string. This is useful for t
248  multiple copies of the same substring.  multiple copies of the same substring.
249  </P>  </P>
250  <P>  <P>
251    The <b>/B</b> modifier is a debugging feature. It requests that <b>pcretest</b>
252    output a representation of the compiled byte code after compilation.
253    </P>
254    <P>
255  The <b>/L</b> modifier must be followed directly by the name of a locale, for  The <b>/L</b> modifier must be followed directly by the name of a locale, for
256  example,  example,
257  <pre>  <pre>
# Line 238  so on). It does this by calling <b>pcre_ Line 270  so on). It does this by calling <b>pcre_
270  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.
271  </P>  </P>
272  <P>  <P>
273  The <b>/D</b> modifier is a PCRE debugging feature, which also assumes <b>/I</b>.  The <b>/D</b> modifier is a PCRE debugging feature, and is equivalent to
274  It causes the internal form of compiled regular expressions to be output after  <b>/BI</b>, that is, both the \fP/B\fP and the <b>/I</b> modifiers.
 compilation. If the pattern was studied, the information returned is also  
 output.  
275  </P>  </P>
276  <P>  <P>
277  The <b>/F</b> modifier causes <b>pcretest</b> to flip the byte order of the  The <b>/F</b> modifier causes <b>pcretest</b> to flip the byte order of the
# Line 289  complicated features of PCRE. If you are Line 319  complicated features of PCRE. If you are
319  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
320  recognized:  recognized:
321  <pre>  <pre>
322    \a         alarm (= BEL)    \a         alarm (BEL, \x07)
323    \b         backspace    \b         backspace (\x08)
324    \e         escape    \e         escape (\x27)
325    \f         formfeed    \f         formfeed (\x0c)
326    \n         newline    \n         newline (\x0a)
327    \qdd       set the PCRE_MATCH_LIMIT limit to dd (any number of digits)    \qdd       set the PCRE_MATCH_LIMIT limit to dd (any number of digits)
328    \r         carriage return    \r         carriage return (\x0d)
329    \t         tab    \t         tab (\x09)
330    \v         vertical tab    \v         vertical tab (\x0b)
331    \nnn       octal character (up to 3 octal digits)    \nnn       octal character (up to 3 octal digits)
332    \xhh       hexadecimal character (up to 2 hex digits)    \xhh       hexadecimal character (up to 2 hex digits)
333    \x{hh...}  hexadecimal character, any number of digits in UTF-8 mode    \x{hh...}  hexadecimal character, any number of digits in UTF-8 mode
# Line 331  recognized: Line 361  recognized:
361    \&#60;cr&#62;      pass the PCRE_NEWLINE_CR option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>    \&#60;cr&#62;      pass the PCRE_NEWLINE_CR option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>
362    \&#60;lf&#62;      pass the PCRE_NEWLINE_LF option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>    \&#60;lf&#62;      pass the PCRE_NEWLINE_LF option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>
363    \&#60;crlf&#62;    pass the PCRE_NEWLINE_CRLF option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>    \&#60;crlf&#62;    pass the PCRE_NEWLINE_CRLF option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>
364      \&#60;any&#62;     pass the PCRE_NEWLINE_ANY option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>
365  </pre>  </pre>
366  The escapes that specify line endings are literal strings, exactly as shown.  The escapes that specify line ending sequences are literal strings, exactly as
367  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.
368  very last character is a backslash, it is ignored. This gives a way of passing  </P>
369  an empty line as data, since a real empty line terminates the data input.  <P>
370    A backslash followed by anything else just escapes the anything else. If
371    the very last character is a backslash, it is ignored. This gives a way of
372    passing an empty line as data, since a real empty line terminates the data
373    input.
374  </P>  </P>
375  <P>  <P>
376  If \M is present, <b>pcretest</b> calls <b>pcre_exec()</b> several times, with  If \M is present, <b>pcretest</b> calls <b>pcre_exec()</b> several times, with
# Line 398  respectively, and otherwise the PCRE neg Line 433  respectively, and otherwise the PCRE neg
433  of an interactive <b>pcretest</b> run.  of an interactive <b>pcretest</b> run.
434  <pre>  <pre>
435    $ pcretest    $ pcretest
436    PCRE version 5.00 07-Sep-2004    PCRE version 7.0 30-Nov-2006
437    
438      re&#62; /^abc(\d+)/      re&#62; /^abc(\d+)/
439    data&#62; abc123    data&#62; abc123
# Line 409  of an interactive <b>pcretest</b> run. Line 444  of an interactive <b>pcretest</b> run.
444  </pre>  </pre>
445  If the strings contain any non-printing characters, they are output as \0x  If the strings contain any non-printing characters, they are output as \0x
446  escapes, or as \x{...} escapes if the <b>/8</b> modifier was present on the  escapes, or as \x{...} escapes if the <b>/8</b> modifier was present on the
447  pattern. If the pattern has the <b>/+</b> modifier, the output for substring 0  pattern. See below for the definition of non-printing characters. If the
448  is followed by the the rest of the subject string, identified by "0+" like  pattern has the <b>/+</b> modifier, the output for substring 0 is followed by
449  this:  the the rest of the subject string, identified by "0+" like this:
450  <pre>  <pre>
451      re&#62; /cat/+      re&#62; /cat/+
452    data&#62; cataract    data&#62; cataract
# Line 441  length (that is, the return from the ext Line 476  length (that is, the return from the ext
476  parentheses after each string for <b>\C</b> and <b>\G</b>.  parentheses after each string for <b>\C</b> and <b>\G</b>.
477  </P>  </P>
478  <P>  <P>
479  Note that while patterns can be continued over several lines (a plain "&#62;"  Note that whereas patterns can be continued over several lines (a plain "&#62;"
480  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
481  included in data by means of the \n escape (or \r or \r\n for those newline  included in data by means of the \n escape (or \r, \r\n, etc., depending on
482  settings).  the newline sequence setting).
483  </P>  </P>
484  <br><a name="SEC8" href="#TOC1">OUTPUT FROM THE ALTERNATIVE MATCHING FUNCTION</a><br>  <br><a name="SEC8" href="#TOC1">OUTPUT FROM THE ALTERNATIVE MATCHING FUNCTION</a><br>
485  <P>  <P>
# Line 463  the subject where there is at least one Line 498  the subject where there is at least one
498  longest matching string is always given first (and numbered zero).  longest matching string is always given first (and numbered zero).
499  </P>  </P>
500  <P>  <P>
501  If \fB/g\P is present on the pattern, the search for further matches resumes  If <b>/g</b> is present on the pattern, the search for further matches resumes
502  at the end of the longest match. For example:  at the end of the longest match. For example:
503  <pre>  <pre>
504      re&#62; /(tang|tangerine|tan)/g      re&#62; /(tang|tangerine|tan)/g
# Line 537  the Line 572  the
572  <a href="pcrecallout.html"><b>pcrecallout</b></a>  <a href="pcrecallout.html"><b>pcrecallout</b></a>
573  documentation.  documentation.
574  </P>  </P>
575  <br><a name="SEC11" href="#TOC1">SAVING AND RELOADING COMPILED PATTERNS</a><br>  <br><a name="SEC11" href="#TOC1">NON-PRINTING CHARACTERS</a><br>
576    <P>
577    When <b>pcretest</b> is outputting text in the compiled version of a pattern,
578    bytes other than 32-126 are always treated as non-printing characters are are
579    therefore shown as hex escapes.
580    </P>
581    <P>
582    When <b>pcretest</b> is outputting text that is a matched part of a subject
583    string, it behaves in the same way, unless a different locale has been set for
584    the pattern (using the <b>/L</b> modifier). In this case, the <b>isprint()</b>
585    function to distinguish printing and non-printing characters.
586    </P>
587    <br><a name="SEC12" href="#TOC1">SAVING AND RELOADING COMPILED PATTERNS</a><br>
588  <P>  <P>
589  The facilities described in this section are not available when the POSIX  The facilities described in this section are not available when the POSIX
590  inteface to PCRE is being used, that is, when the <b>/P</b> pattern modifier is  inteface to PCRE is being used, that is, when the <b>/P</b> pattern modifier is
# Line 599  string using a reloaded pattern is likel Line 646  string using a reloaded pattern is likel
646  Finally, if you attempt to load a file that is not in the correct format, the  Finally, if you attempt to load a file that is not in the correct format, the
647  result is undefined.  result is undefined.
648  </P>  </P>
649  <br><a name="SEC12" href="#TOC1">AUTHOR</a><br>  <br><a name="SEC13" href="#TOC1">SEE ALSO</a><br>
650    <P>
651    <b>pcre</b>(3), <b>pcreapi</b>(3), <b>pcrecallout</b>(3), <b>pcrematching</b>(3),
652    <b>pcrepartial</b>(d), \fPpcrepattern\fP(3), <b>pcreprecompile</b>(3).
653    </P>
654    <br><a name="SEC14" href="#TOC1">AUTHOR</a><br>
655  <P>  <P>
656  Philip Hazel  Philip Hazel
657  <br>  <br>
658  University Computing Service,  University Computing Service
659    <br>
660    Cambridge CB2 3QH, England.
661  <br>  <br>
 Cambridge CB2 3QG, England.  
662  </P>  </P>
663    <br><a name="SEC15" href="#TOC1">REVISION</a><br>
664  <P>  <P>
665  Last updated: 29 June 2006  Last updated: 06 March 2007
666    <br>
667    Copyright &copy; 1997-2007 University of Cambridge.
668  <br>  <br>
 Copyright &copy; 1997-2006 University of Cambridge.  
669  <p>  <p>
670  Return to the <a href="index.html">PCRE index page</a>.  Return to the <a href="index.html">PCRE index page</a>.
671  </p>  </p>

Legend:
Removed from v.91  
changed lines
  Added in v.99

  ViewVC Help
Powered by ViewVC 1.1.5