187 |
bytes for both libraries. |
bytes for both libraries. |
188 |
</P> |
</P> |
189 |
<P> |
<P> |
190 |
|
<b>-O</b> |
191 |
|
Behave as if each pattern has the <b>/O</b> modifier, that is disable |
192 |
|
auto-possessification for all patterns. |
193 |
|
</P> |
194 |
|
<P> |
195 |
<b>-o</b> <i>osize</i> |
<b>-o</b> <i>osize</i> |
196 |
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 |
197 |
<b>pcre[16|32]_exec()</b> or <b>pcre[16|32]_dfa_exec()</b> to be <i>osize</i>. The |
<b>pcre[16|32]_exec()</b> or <b>pcre[16|32]_dfa_exec()</b> to be <i>osize</i>. The |
261 |
</P> |
</P> |
262 |
<P> |
<P> |
263 |
<b>-t</b> |
<b>-t</b> |
264 |
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 the |
265 |
resulting time per compile or match (in milliseconds). Do not set <b>-m</b> with |
resulting times per compile, study, or match (in milliseconds). Do not set |
266 |
<b>-t</b>, because you will then get the size output a zillion times, and the |
<b>-m</b> with <b>-t</b>, because you will then get the size output a zillion |
267 |
timing will be distorted. You can control the number of iterations that are |
times, and the timing will be distorted. You can control the number of |
268 |
used for timing by following <b>-t</b> with a number (as a separate item on the |
iterations that are used for timing by following <b>-t</b> with a number (as a |
269 |
command line). For example, "-t 1000" would iterate 1000 times. The default is |
separate item on the command line). For example, "-t 1000" iterates 1000 times. |
270 |
to iterate 500000 times. |
The default is to iterate 500000 times. |
271 |
</P> |
</P> |
272 |
<P> |
<P> |
273 |
<b>-tm</b> |
<b>-tm</b> |
274 |
This is like <b>-t</b> except that it times only the matching phase, not the |
This is like <b>-t</b> except that it times only the matching phase, not the |
275 |
compile or study phases. |
compile or study phases. |
276 |
</P> |
</P> |
277 |
|
<P> |
278 |
|
<b>-T</b> <b>-TM</b> |
279 |
|
These behave like <b>-t</b> and <b>-tm</b>, but in addition, at the end of a run, |
280 |
|
the total times for all compiles, studies, and matches are output. |
281 |
|
</P> |
282 |
<br><a name="SEC5" href="#TOC1">DESCRIPTION</a><br> |
<br><a name="SEC5" href="#TOC1">DESCRIPTION</a><br> |
283 |
<P> |
<P> |
284 |
If <b>pcretest</b> is given two filename arguments, it reads from the first and |
If <b>pcretest</b> is given two filename arguments, it reads from the first and |
297 |
<P> |
<P> |
298 |
The program handles any number of sets of input on a single input file. Each |
The program handles any number of sets of input on a single input file. Each |
299 |
set starts with a regular expression, and continues with any number of data |
set starts with a regular expression, and continues with any number of data |
300 |
lines to be matched against the pattern. |
lines to be matched against that pattern. |
301 |
</P> |
</P> |
302 |
<P> |
<P> |
303 |
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 |
371 |
<b>/M</b> show compiled memory size |
<b>/M</b> show compiled memory size |
372 |
<b>/m</b> set PCRE_MULTILINE |
<b>/m</b> set PCRE_MULTILINE |
373 |
<b>/N</b> set PCRE_NO_AUTO_CAPTURE |
<b>/N</b> set PCRE_NO_AUTO_CAPTURE |
374 |
|
<b>/O</b> set PCRE_NO_AUTO_POSSESS |
375 |
<b>/P</b> use the POSIX wrapper |
<b>/P</b> use the POSIX wrapper |
376 |
<b>/S</b> study the pattern after compilation |
<b>/S</b> study the pattern after compilation |
377 |
<b>/s</b> set PCRE_DOTALL |
<b>/s</b> set PCRE_DOTALL |
430 |
<b>/f</b> PCRE_FIRSTLINE |
<b>/f</b> PCRE_FIRSTLINE |
431 |
<b>/J</b> PCRE_DUPNAMES |
<b>/J</b> PCRE_DUPNAMES |
432 |
<b>/N</b> PCRE_NO_AUTO_CAPTURE |
<b>/N</b> PCRE_NO_AUTO_CAPTURE |
433 |
|
<b>/O</b> PCRE_NO_AUTO_POSSESS |
434 |
<b>/U</b> PCRE_UNGREEDY |
<b>/U</b> PCRE_UNGREEDY |
435 |
<b>/W</b> PCRE_UCP |
<b>/W</b> PCRE_UCP |
436 |
<b>/X</b> PCRE_EXTRA |
<b>/X</b> PCRE_EXTRA |
574 |
They may appear in any order. |
They may appear in any order. |
575 |
</P> |
</P> |
576 |
<P> |
<P> |
577 |
If <b>S</b> is followed by an exclamation mark, <b>pcre[16|32]_study()</b> is called |
If <b>/S</b> is followed by an exclamation mark, <b>pcre[16|32]_study()</b> is |
578 |
with the PCRE_STUDY_EXTRA_NEEDED option, causing it always to return a |
called with the PCRE_STUDY_EXTRA_NEEDED option, causing it always to return a |
579 |
<b>pcre_extra</b> block, even when studying discovers no useful information. |
<b>pcre_extra</b> block, even when studying discovers no useful information. |
580 |
</P> |
</P> |
581 |
<P> |
<P> |
654 |
The <b>/+</b> modifier works as described above. All other modifiers are |
The <b>/+</b> modifier works as described above. All other modifiers are |
655 |
ignored. |
ignored. |
656 |
</P> |
</P> |
657 |
|
<br><b> |
658 |
|
Locking out certain modifiers |
659 |
|
</b><br> |
660 |
|
<P> |
661 |
|
PCRE can be compiled with or without support for certain features such as |
662 |
|
UTF-8/16/32 or Unicode properties. Accordingly, the standard tests are split up |
663 |
|
into a number of different files that are selected for running depending on |
664 |
|
which features are available. When updating the tests, it is all too easy to |
665 |
|
put a new test into the wrong file by mistake; for example, to put a test that |
666 |
|
requires UTF support into a file that is used when it is not available. To help |
667 |
|
detect such mistakes as early as possible, there is a facility for locking out |
668 |
|
specific modifiers. If an input line for <b>pcretest</b> starts with the string |
669 |
|
"< forbid " the following sequence of characters is taken as a list of |
670 |
|
forbidden modifiers. For example, in the test files that must not use UTF or |
671 |
|
Unicode property support, this line appears: |
672 |
|
<pre> |
673 |
|
< forbid 8W |
674 |
|
</pre> |
675 |
|
This locks out the /8 and /W modifiers. An immediate error is given if they are |
676 |
|
subsequently encountered. If the character string contains < but not >, all the |
677 |
|
multi-character modifiers that begin with < are locked out. Otherwise, such |
678 |
|
modifiers must be explicitly listed, for example: |
679 |
|
<pre> |
680 |
|
< forbid <JS><cr> |
681 |
|
</pre> |
682 |
|
There must be a single space between < and "forbid" for this feature to be |
683 |
|
recognised. If there is not, the line is interpreted either as a request to |
684 |
|
re-load a pre-compiled pattern (see "SAVING AND RELOADING COMPILED PATTERNS" |
685 |
|
below) or, if there is a another < character, as a pattern that uses < as its |
686 |
|
delimiter. |
687 |
|
</P> |
688 |
<br><a name="SEC7" href="#TOC1">DATA LINES</a><br> |
<br><a name="SEC7" href="#TOC1">DATA LINES</a><br> |
689 |
<P> |
<P> |
690 |
Before each data line is passed to <b>pcre[16|32]_exec()</b>, leading and trailing |
Before each data line is passed to <b>pcre[16|32]_exec()</b>, leading and trailing |
705 |
\v vertical tab (\x0b) |
\v vertical tab (\x0b) |
706 |
\nnn octal character (up to 3 octal digits); always |
\nnn octal character (up to 3 octal digits); always |
707 |
a byte unless > 255 in UTF-8 or 16-bit or 32-bit mode |
a byte unless > 255 in UTF-8 or 16-bit or 32-bit mode |
708 |
|
\o{dd...} octal character (any number of octal digits} |
709 |
\xhh hexadecimal byte (up to 2 hex digits) |
\xhh hexadecimal byte (up to 2 hex digits) |
710 |
\x{hh...} hexadecimal character (any number of hex digits) |
\x{hh...} hexadecimal character (any number of hex digits) |
711 |
\A pass the PCRE_ANCHORED option to <b>pcre[16|32]_exec()</b> or <b>pcre[16|32]_dfa_exec()</b> |
\A pass the PCRE_ANCHORED option to <b>pcre[16|32]_exec()</b> or <b>pcre[16|32]_dfa_exec()</b> |
1075 |
</P> |
</P> |
1076 |
<P> |
<P> |
1077 |
A saved pattern can be reloaded into <b>pcretest</b> by specifying < and a file |
A saved pattern can be reloaded into <b>pcretest</b> by specifying < and a file |
1078 |
name instead of a pattern. The name of the file must not contain a < character, |
name instead of a pattern. There must be no space between < and the file name, |
1079 |
as otherwise <b>pcretest</b> will interpret the line as a pattern delimited by < |
which must not contain a < character, as otherwise <b>pcretest</b> will |
1080 |
characters. |
interpret the line as a pattern delimited by < characters. For example: |
|
For example: |
|
1081 |
<pre> |
<pre> |
1082 |
re> </some/file |
re> </some/file |
1083 |
Compiled pattern loaded from /some/file |
Compiled pattern loaded from /some/file |
1134 |
</P> |
</P> |
1135 |
<br><a name="SEC17" href="#TOC1">REVISION</a><br> |
<br><a name="SEC17" href="#TOC1">REVISION</a><br> |
1136 |
<P> |
<P> |
1137 |
Last updated: 26 April 2013 |
Last updated: 12 November 2013 |
1138 |
<br> |
<br> |
1139 |
Copyright © 1997-2013 University of Cambridge. |
Copyright © 1997-2013 University of Cambridge. |
1140 |
<br> |
<br> |