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 |
</ul> |
</ul> |
31 |
<br><a name="SEC1" href="#TOC1">SYNOPSIS</a><br> |
<br><a name="SEC1" href="#TOC1">SYNOPSIS</a><br> |
32 |
<P> |
<P> |
45 |
</P> |
</P> |
46 |
<br><a name="SEC2" href="#TOC1">OPTIONS</a><br> |
<br><a name="SEC2" href="#TOC1">OPTIONS</a><br> |
47 |
<P> |
<P> |
48 |
|
<b>-b</b> |
49 |
|
Behave as if each regex has the <b>/B</b> (show bytecode) modifier; the internal |
50 |
|
form is output after compilation. |
51 |
|
</P> |
52 |
|
<P> |
53 |
<b>-C</b> |
<b>-C</b> |
54 |
Output the version number of the PCRE library, and all available information |
Output the version number of the PCRE library, and all available information |
55 |
about the optional features that are included, and then exit. |
about the optional features that are included, and then exit. |
57 |
<P> |
<P> |
58 |
<b>-d</b> |
<b>-d</b> |
59 |
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 |
60 |
form is output after compilation. |
form and information about the compiled pattern is output after compilation; |
61 |
|
<b>-d</b> is equivalent to <b>-b -i</b>. |
62 |
</P> |
</P> |
63 |
<P> |
<P> |
64 |
<b>-dfa</b> |
<b>-dfa</b> |
67 |
standard <b>pcre_exec()</b> function (more detail is given below). |
standard <b>pcre_exec()</b> function (more detail is given below). |
68 |
</P> |
</P> |
69 |
<P> |
<P> |
70 |
|
<b>-help</b> |
71 |
|
Output a brief summary these options and then exit. |
72 |
|
</P> |
73 |
|
<P> |
74 |
<b>-i</b> |
<b>-i</b> |
75 |
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 |
76 |
compiled pattern is given after compilation. |
compiled pattern is given after compilation. |
84 |
<P> |
<P> |
85 |
<b>-o</b> <i>osize</i> |
<b>-o</b> <i>osize</i> |
86 |
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 |
87 |
<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 |
88 |
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 |
89 |
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 |
90 |
|
changed for individual matching calls by including \O in the data line (see |
91 |
|
below). |
92 |
</P> |
</P> |
93 |
<P> |
<P> |
94 |
<b>-p</b> |
<b>-p</b> |
110 |
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 |
111 |
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 |
112 |
<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 |
113 |
timing will be distorted. |
timing will be distorted. You can control the number of iterations that are |
114 |
|
used for timing by following <b>-t</b> with a number (as a separate item on the |
115 |
|
command line). For example, "-t 1000" would iterate 1000 times. The default is |
116 |
|
to iterate 500000 times. |
117 |
|
</P> |
118 |
|
<P> |
119 |
|
<b>-tm</b> |
120 |
|
This is like <b>-t</b> except that it times only the matching phase, not the |
121 |
|
compile or study phases. |
122 |
</P> |
</P> |
123 |
<br><a name="SEC3" href="#TOC1">DESCRIPTION</a><br> |
<br><a name="SEC3" href="#TOC1">DESCRIPTION</a><br> |
124 |
<P> |
<P> |
136 |
<P> |
<P> |
137 |
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 |
138 |
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, |
139 |
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 |
140 |
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 |
141 |
buffer is automatically extended if it is too small. |
buffer is automatically extended if it is too small. |
142 |
</P> |
</P> |
143 |
<P> |
<P> |
201 |
<b>/<cr></b> PCRE_NEWLINE_CR |
<b>/<cr></b> PCRE_NEWLINE_CR |
202 |
<b>/<lf></b> PCRE_NEWLINE_LF |
<b>/<lf></b> PCRE_NEWLINE_LF |
203 |
<b>/<crlf></b> PCRE_NEWLINE_CRLF |
<b>/<crlf></b> PCRE_NEWLINE_CRLF |
204 |
|
<b>/<any></b> PCRE_NEWLINE_ANY |
205 |
|
</pre> |
206 |
|
Those specifying line ending sequencess are literal strings as shown. This |
207 |
|
example sets multiline matching with CRLF as the line ending sequence: |
208 |
|
<pre> |
209 |
|
/^abc/m<crlf> |
210 |
</pre> |
</pre> |
211 |
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 |
|
212 |
<a href="pcreapi.html"><b>pcreapi</b></a> |
<a href="pcreapi.html"><b>pcreapi</b></a> |
213 |
documentation. |
documentation. |
214 |
</P> |
</P> |
247 |
multiple copies of the same substring. |
multiple copies of the same substring. |
248 |
</P> |
</P> |
249 |
<P> |
<P> |
250 |
|
The <b>/B</b> modifier is a debugging feature. It requests that <b>pcretest</b> |
251 |
|
output a representation of the compiled byte code after compilation. |
252 |
|
</P> |
253 |
|
<P> |
254 |
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 |
255 |
example, |
example, |
256 |
<pre> |
<pre> |
269 |
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. |
270 |
</P> |
</P> |
271 |
<P> |
<P> |
272 |
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 |
273 |
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. |
|
274 |
</P> |
</P> |
275 |
<P> |
<P> |
276 |
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 |
318 |
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 |
319 |
recognized: |
recognized: |
320 |
<pre> |
<pre> |
321 |
\a alarm (= BEL) |
\a alarm (BEL, \x07) |
322 |
\b backspace |
\b backspace (\x08) |
323 |
\e escape |
\e escape (\x27) |
324 |
\f formfeed |
\f formfeed (\x0c) |
325 |
\n newline |
\n newline (\x0a) |
326 |
\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) |
327 |
\r carriage return |
\r carriage return (\x0d) |
328 |
\t tab |
\t tab (\x09) |
329 |
\v vertical tab |
\v vertical tab (\x0b) |
330 |
\nnn octal character (up to 3 octal digits) |
\nnn octal character (up to 3 octal digits) |
331 |
\xhh hexadecimal character (up to 2 hex digits) |
\xhh hexadecimal character (up to 2 hex digits) |
332 |
\x{hh...} hexadecimal character, any number of digits in UTF-8 mode |
\x{hh...} hexadecimal character, any number of digits in UTF-8 mode |
360 |
\<cr> pass the PCRE_NEWLINE_CR option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b> |
\<cr> pass the PCRE_NEWLINE_CR option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b> |
361 |
\<lf> pass the PCRE_NEWLINE_LF option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b> |
\<lf> pass the PCRE_NEWLINE_LF option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b> |
362 |
\<crlf> pass the PCRE_NEWLINE_CRLF option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b> |
\<crlf> pass the PCRE_NEWLINE_CRLF option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b> |
363 |
|
\<any> pass the PCRE_NEWLINE_ANY option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b> |
364 |
</pre> |
</pre> |
365 |
The escapes that specify line endings are literal strings, exactly as shown. |
The escapes that specify line ending sequences are literal strings, exactly as |
366 |
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. |
367 |
very last character is a backslash, it is ignored. This gives a way of passing |
</P> |
368 |
an empty line as data, since a real empty line terminates the data input. |
<P> |
369 |
|
A backslash followed by anything else just escapes the anything else. If |
370 |
|
the very last character is a backslash, it is ignored. This gives a way of |
371 |
|
passing an empty line as data, since a real empty line terminates the data |
372 |
|
input. |
373 |
</P> |
</P> |
374 |
<P> |
<P> |
375 |
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 |
432 |
of an interactive <b>pcretest</b> run. |
of an interactive <b>pcretest</b> run. |
433 |
<pre> |
<pre> |
434 |
$ pcretest |
$ pcretest |
435 |
PCRE version 5.00 07-Sep-2004 |
PCRE version 7.0 30-Nov-2006 |
436 |
|
|
437 |
re> /^abc(\d+)/ |
re> /^abc(\d+)/ |
438 |
data> abc123 |
data> abc123 |
443 |
</pre> |
</pre> |
444 |
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 |
445 |
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 |
446 |
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 |
447 |
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 |
448 |
this: |
the the rest of the subject string, identified by "0+" like this: |
449 |
<pre> |
<pre> |
450 |
re> /cat/+ |
re> /cat/+ |
451 |
data> cataract |
data> cataract |
475 |
parentheses after each string for <b>\C</b> and <b>\G</b>. |
parentheses after each string for <b>\C</b> and <b>\G</b>. |
476 |
</P> |
</P> |
477 |
<P> |
<P> |
478 |
Note that while patterns can be continued over several lines (a plain ">" |
Note that whereas patterns can be continued over several lines (a plain ">" |
479 |
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 |
480 |
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 |
481 |
settings). |
the newline sequence setting). |
482 |
</P> |
</P> |
483 |
<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> |
484 |
<P> |
<P> |
497 |
longest matching string is always given first (and numbered zero). |
longest matching string is always given first (and numbered zero). |
498 |
</P> |
</P> |
499 |
<P> |
<P> |
500 |
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 |
501 |
at the end of the longest match. For example: |
at the end of the longest match. For example: |
502 |
<pre> |
<pre> |
503 |
re> /(tang|tangerine|tan)/g |
re> /(tang|tangerine|tan)/g |
571 |
<a href="pcrecallout.html"><b>pcrecallout</b></a> |
<a href="pcrecallout.html"><b>pcrecallout</b></a> |
572 |
documentation. |
documentation. |
573 |
</P> |
</P> |
574 |
<br><a name="SEC11" href="#TOC1">SAVING AND RELOADING COMPILED PATTERNS</a><br> |
<br><a name="SEC11" href="#TOC1">NON-PRINTING CHARACTERS</a><br> |
575 |
|
<P> |
576 |
|
When <b>pcretest</b> is outputting text in the compiled version of a pattern, |
577 |
|
bytes other than 32-126 are always treated as non-printing characters are are |
578 |
|
therefore shown as hex escapes. |
579 |
|
</P> |
580 |
|
<P> |
581 |
|
When <b>pcretest</b> is outputting text that is a matched part of a subject |
582 |
|
string, it behaves in the same way, unless a different locale has been set for |
583 |
|
the pattern (using the <b>/L</b> modifier). In this case, the <b>isprint()</b> |
584 |
|
function to distinguish printing and non-printing characters. |
585 |
|
</P> |
586 |
|
<br><a name="SEC12" href="#TOC1">SAVING AND RELOADING COMPILED PATTERNS</a><br> |
587 |
<P> |
<P> |
588 |
The facilities described in this section are not available when the POSIX |
The facilities described in this section are not available when the POSIX |
589 |
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 |
645 |
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 |
646 |
result is undefined. |
result is undefined. |
647 |
</P> |
</P> |
648 |
<br><a name="SEC12" href="#TOC1">AUTHOR</a><br> |
<br><a name="SEC13" href="#TOC1">SEE ALSO</a><br> |
649 |
|
<P> |
650 |
|
<b>pcre</b>(3), <b>pcreapi</b>(3), <b>pcrecallout</b>(3), <b>pcrematching</b>(3), |
651 |
|
<b>pcrepartial</b>(d), \fPpcrepattern\fP(3), <b>pcreprecompile</b>(3). |
652 |
|
</P> |
653 |
|
<br><a name="SEC14" href="#TOC1">AUTHOR</a><br> |
654 |
<P> |
<P> |
655 |
Philip Hazel |
Philip Hazel |
656 |
<br> |
<br> |
657 |
University Computing Service, |
University Computing Service, |
658 |
<br> |
<br> |
659 |
Cambridge CB2 3QG, England. |
Cambridge CB2 3QH, England. |
660 |
</P> |
</P> |
661 |
<P> |
<P> |
662 |
Last updated: 29 June 2006 |
Last updated: 30 November 2006 |
663 |
<br> |
<br> |
664 |
Copyright © 1997-2006 University of Cambridge. |
Copyright © 1997-2006 University of Cambridge. |
665 |
<p> |
<p> |