| 25 |
.rs |
.rs |
| 26 |
.TP 10 |
.TP 10 |
| 27 |
\fB-b\fP |
\fB-b\fP |
| 28 |
Behave as if each regex has the \fB/B\fP (show bytecode) modifier; the internal |
Behave as if each regex has the \fB/B\fP (show byte code) modifier; the |
| 29 |
form is output after compilation. |
internal form is output after compilation. |
| 30 |
.TP 10 |
.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 |
| 76 |
Do not output the version number of \fBpcretest\fP at the start of execution. |
Do not output the version number of \fBpcretest\fP at the start of execution. |
| 77 |
.TP 10 |
.TP 10 |
| 78 |
\fB-S\fP \fIsize\fP |
\fB-S\fP \fIsize\fP |
| 79 |
On Unix-like systems, set the size of the runtime stack to \fIsize\fP |
On Unix-like systems, set the size of the run-time stack to \fIsize\fP |
| 80 |
megabytes. |
megabytes. |
| 81 |
.TP 10 |
.TP 10 |
| 82 |
\fB-t\fP |
\fB-t\fP |
| 154 |
A pattern may be followed by any number of modifiers, which are mostly single |
A pattern may be followed by any number of modifiers, which are mostly single |
| 155 |
characters. Following Perl usage, these are referred to below as, for example, |
characters. Following Perl usage, these are referred to below as, for example, |
| 156 |
"the \fB/i\fP modifier", even though the delimiter of the pattern need not |
"the \fB/i\fP modifier", even though the delimiter of the pattern need not |
| 157 |
always be a slash, and no slash is used when writing modifiers. Whitespace may |
always be a slash, and no slash is used when writing modifiers. White space may |
| 158 |
appear between the final pattern delimiter and the first modifier, and between |
appear between the final pattern delimiter and the first modifier, and between |
| 159 |
the modifiers themselves. |
the modifiers themselves. |
| 160 |
.P |
.P |
| 327 |
.rs |
.rs |
| 328 |
.sp |
.sp |
| 329 |
Before each data line is passed to \fBpcre_exec()\fP, leading and trailing |
Before each data line is passed to \fBpcre_exec()\fP, leading and trailing |
| 330 |
whitespace is removed, and it is then scanned for \e escapes. Some of these are |
white space is removed, and it is then scanned for \e escapes. Some of these |
| 331 |
pretty esoteric features, intended for checking out some of the more |
are pretty esoteric features, intended for checking out some of the more |
| 332 |
complicated features of PCRE. If you are just testing "ordinary" regular |
complicated features of PCRE. If you are just testing "ordinary" regular |
| 333 |
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 |
| 334 |
recognized: |
recognized: |
| 336 |
\ea alarm (BEL, \ex07) |
\ea alarm (BEL, \ex07) |
| 337 |
\eb backspace (\ex08) |
\eb backspace (\ex08) |
| 338 |
\ee escape (\ex27) |
\ee escape (\ex27) |
| 339 |
\ef formfeed (\ex0c) |
\ef form feed (\ex0c) |
| 340 |
\en newline (\ex0a) |
\en newline (\ex0a) |
| 341 |
.\" JOIN |
.\" JOIN |
| 342 |
\eqdd set the PCRE_MATCH_LIMIT limit to dd |
\eqdd set the PCRE_MATCH_LIMIT limit to dd |
| 507 |
This section describes the output when the normal matching function, |
This section describes the output when the normal matching function, |
| 508 |
\fBpcre_exec()\fP, is being used. |
\fBpcre_exec()\fP, is being used. |
| 509 |
.P |
.P |
| 510 |
When a match succeeds, pcretest outputs the list of captured substrings that |
When a match succeeds, \fBpcretest\fP outputs the list of captured substrings |
| 511 |
\fBpcre_exec()\fP returns, starting with number 0 for the string that matched |
that \fBpcre_exec()\fP returns, starting with number 0 for the string that |
| 512 |
the whole pattern. Otherwise, it outputs "No match" when the return is |
matched the whole pattern. Otherwise, it outputs "No match" when the return is |
| 513 |
PCRE_ERROR_NOMATCH, and "Partial match:" followed by the partially matching |
PCRE_ERROR_NOMATCH, and "Partial match:" followed by the partially matching |
| 514 |
substring when \fBpcre_exec()\fP returns PCRE_ERROR_PARTIAL. (Note that this is |
substring when \fBpcre_exec()\fP returns PCRE_ERROR_PARTIAL. (Note that this is |
| 515 |
the entire substring that was inspected during the partial match; it may |
the entire substring that was inspected during the partial match; it may |
| 516 |
include characters before the actual match start if a lookbehind assertion, |
include characters before the actual match start if a lookbehind assertion, |
| 517 |
\eK, \eb, or \eB was involved.) For any other returns, it outputs the PCRE |
\eK, \eb, or \eB was involved.) For any other return, \fBpcretest\fP outputs |
| 518 |
negative error number. Here is an example of an interactive \fBpcretest\fP run. |
the PCRE negative error number and a short descriptive phrase. If the error is |
| 519 |
|
a failed UTF-8 string check, the byte offset of the start of the failing |
| 520 |
|
character and the reason code are also output, provided that the size of the |
| 521 |
|
output vector is at least two. Here is an example of an interactive |
| 522 |
|
\fBpcretest\fP run. |
| 523 |
.sp |
.sp |
| 524 |
$ pcretest |
$ pcretest |
| 525 |
PCRE version 7.0 30-Nov-2006 |
PCRE version 8.13 2011-04-30 |
| 526 |
.sp |
.sp |
| 527 |
re> /^abc(\ed+)/ |
re> /^abc(\ed+)/ |
| 528 |
data> abc123 |
data> abc123 |
| 531 |
data> xyz |
data> xyz |
| 532 |
No match |
No match |
| 533 |
.sp |
.sp |
| 534 |
Note that unset capturing substrings that are not followed by one that is set |
Unset capturing substrings that are not followed by one that is set are not |
| 535 |
are not returned by \fBpcre_exec()\fP, and are not shown by \fBpcretest\fP. In |
returned by \fBpcre_exec()\fP, and are not shown by \fBpcretest\fP. In the |
| 536 |
the following example, there are two capturing substrings, but when the first |
following example, there are two capturing substrings, but when the first data |
| 537 |
data line is matched, the second, unset substring is not shown. An "internal" |
line is matched, the second, unset substring is not shown. An "internal" unset |
| 538 |
unset substring is shown as "<unset>", as for the second data line. |
substring is shown as "<unset>", as for the second data line. |
| 539 |
.sp |
.sp |
| 540 |
re> /(a)|(b)/ |
re> /(a)|(b)/ |
| 541 |
data> a |
data> a |
| 569 |
0: ipp |
0: ipp |
| 570 |
1: pp |
1: pp |
| 571 |
.sp |
.sp |
| 572 |
"No match" is output only if the first match attempt fails. |
"No match" is output only if the first match attempt fails. Here is an example |
| 573 |
|
of a failure message (the offset 4 that is specified by \e>4 is past the end of |
| 574 |
|
the subject string): |
| 575 |
|
.sp |
| 576 |
|
re> /xyz/ |
| 577 |
|
data> xyz\>4 |
| 578 |
|
Error -24 (bad offset value) |
| 579 |
.P |
.P |
| 580 |
If any of the sequences \fB\eC\fP, \fB\eG\fP, or \fB\eL\fP are present in a |
If any of the sequences \fB\eC\fP, \fB\eG\fP, or \fB\eL\fP are present in a |
| 581 |
data line that is successfully matched, the substrings extracted by the |
data line that is successfully matched, the substrings extracted by the |
| 712 |
.rs |
.rs |
| 713 |
.sp |
.sp |
| 714 |
The facilities described in this section are not available when the POSIX |
The facilities described in this section are not available when the POSIX |
| 715 |
inteface to PCRE is being used, that is, when the \fB/P\fP pattern modifier is |
interface to PCRE is being used, that is, when the \fB/P\fP pattern modifier is |
| 716 |
specified. |
specified. |
| 717 |
.P |
.P |
| 718 |
When the POSIX interface is not in use, you can cause \fBpcretest\fP to write a |
When the POSIX interface is not in use, you can cause \fBpcretest\fP to write a |
| 736 |
follows immediately after the compiled pattern. After writing the file, |
follows immediately after the compiled pattern. After writing the file, |
| 737 |
\fBpcretest\fP expects to read a new pattern. |
\fBpcretest\fP expects to read a new pattern. |
| 738 |
.P |
.P |
| 739 |
A saved pattern can be reloaded into \fBpcretest\fP by specifing < and a file |
A saved pattern can be reloaded into \fBpcretest\fP by specifying < and a file |
| 740 |
name instead of a pattern. The name of the file must not contain a < character, |
name instead of a pattern. The name of the file must not contain a < character, |
| 741 |
as otherwise \fBpcretest\fP will interpret the line as a pattern delimited by < |
as otherwise \fBpcretest\fP will interpret the line as a pattern delimited by < |
| 742 |
characters. |
characters. |
| 789 |
.rs |
.rs |
| 790 |
.sp |
.sp |
| 791 |
.nf |
.nf |
| 792 |
Last updated: 21 November 2010 |
Last updated: 07 May 2011 |
| 793 |
Copyright (c) 1997-2010 University of Cambridge. |
Copyright (c) 1997-2011 University of Cambridge. |
| 794 |
.fi |
.fi |