| 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. |
| 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 |
| 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 |
| 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 |
| 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 |
.\" |
.\" |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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" |
| 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 |
| 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 |
| 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 |
| 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. |