tools/pcre/doc/pcretest.1
author Nicholas Hastings <skamonkey@gmail.com>
Sun Mar 17 11:32:03 2013 -0400 (2013-03-17)
changeset 3831 babd0eee3c5e
parent 2762 d2d467bf1b5a
permissions -rw-r--r--
Updated PCRE source to version 8.32 (bug 5593).
     1 .TH PCRETEST 1 "10 September 2012" "PCRE 8.32"
     2 .SH NAME
     3 pcretest - a program for testing Perl-compatible regular expressions.
     4 .SH SYNOPSIS
     5 .rs
     6 .sp
     7 .B pcretest "[options] [input file [output file]]"
     8 .sp
     9 \fBpcretest\fP was written as a test program for the PCRE regular expression
    10 library itself, but it can also be used for experimenting with regular
    11 expressions. This document describes the features of the test program; for
    12 details of the regular expressions themselves, see the
    13 .\" HREF
    14 \fBpcrepattern\fP
    15 .\"
    16 documentation. For details of the PCRE library function calls and their
    17 options, see the
    18 .\" HREF
    19 \fBpcreapi\fP
    20 .\"
    21 ,
    22 .\" HREF
    23 \fBpcre16\fP
    24 and
    25 .\" HREF
    26 \fBpcre32\fP
    27 .\"
    28 documentation.
    29 .P
    30 The input for \fBpcretest\fP is a sequence of regular expression patterns and
    31 strings to be matched, as described below. The output shows the result of each
    32 match. Options on the command line and the patterns control PCRE options and
    33 exactly what is output.
    34 .P
    35 As PCRE has evolved, it has acquired many different features, and as a result,
    36 \fBpcretest\fP now has rather a lot of obscure options for testing every
    37 possible feature. Some of these options are specifically designed for use in
    38 conjunction with the test script and data files that are distributed as part of
    39 PCRE, and are unlikely to be of use otherwise. They are all documented here,
    40 but without much justification.
    41 .
    42 .
    43 .SH "PCRE's 8-BIT, 16-BIT AND 32-BIT LIBRARIES"
    44 .rs
    45 .sp
    46 From release 8.30, two separate PCRE libraries can be built. The original one
    47 supports 8-bit character strings, whereas the newer 16-bit library supports
    48 character strings encoded in 16-bit units. From release 8.32, a third
    49 library can be built, supporting character strings encoded in 32-bit units.
    50 The \fBpcretest\fP program can be
    51 used to test all three libraries. However, it is itself still an 8-bit program,
    52 reading 8-bit input and writing 8-bit output. When testing the 16-bit or 32-bit
    53 library, the patterns and data strings are converted to 16- or 32-bit format
    54 before being passed to the PCRE library functions. Results are converted to
    55 8-bit for output.
    56 .P
    57 References to functions and structures of the form \fBpcre[16|32]_xx\fP below
    58 mean "\fBpcre_xx\fP when using the 8-bit library or \fBpcre16_xx\fP when using
    59 the 16-bit library".
    60 .
    61 .
    62 .SH "COMMAND LINE OPTIONS"
    63 .rs
    64 .TP 10
    65 \fB-8\fP
    66 If both the 8-bit library has been built, this option causes the 8-bit library
    67 to be used (which is the default); if the 8-bit library has not been built,
    68 this option causes an error.
    69 .TP 10
    70 \fB-16\fP
    71 If both the 8-bit or the 32-bit, and the 16-bit libraries have been built, this
    72 option causes the 16-bit library to be used. If only the 16-bit library has been
    73 built, this is the default (so has no effect). If only the 8-bit or the 32-bit
    74 library has been built, this option causes an error.
    75 .TP 10
    76 \fB-32\fP
    77 If both the 8-bit or the 16-bit, and the 32-bit libraries have been built, this
    78 option causes the 32-bit library to be used. If only the 32-bit library has been
    79 built, this is the default (so has no effect). If only the 8-bit or the 16-bit
    80 library has been built, this option causes an error.
    81 .TP 10
    82 \fB-b\fP
    83 Behave as if each pattern has the \fB/B\fP (show byte code) modifier; the
    84 internal form is output after compilation.
    85 .TP 10
    86 \fB-C\fP
    87 Output the version number of the PCRE library, and all available information
    88 about the optional features that are included, and then exit. All other options
    89 are ignored.
    90 .TP 10
    91 \fB-C\fP \fIoption\fP
    92 Output information about a specific build-time option, then exit. This
    93 functionality is intended for use in scripts such as \fBRunTest\fP. The
    94 following options output the value indicated:
    95 .sp
    96   ebcdic-nl  the code for LF (= NL) in an EBCDIC environment:
    97                0x15 or 0x25
    98                0 if used in an ASCII environment
    99   linksize   the internal link size (2, 3, or 4)
   100   newline    the default newline setting:
   101                CR, LF, CRLF, ANYCRLF, or ANY
   102 .sp
   103 The following options output 1 for true or zero for false:
   104 .sp
   105   ebcdic     compiled for an EBCDIC environment
   106   jit        just-in-time support is available
   107   pcre16     the 16-bit library was built
   108   pcre32     the 32-bit library was built
   109   pcre8      the 8-bit library was built
   110   ucp        Unicode property support is available
   111   utf        UTF-8 and/or UTF-16 and/or UTF-32 support is available
   112 .TP 10
   113 \fB-d\fP
   114 Behave as if each pattern has the \fB/D\fP (debug) modifier; the internal
   115 form and information about the compiled pattern is output after compilation;
   116 \fB-d\fP is equivalent to \fB-b -i\fP.
   117 .TP 10
   118 \fB-dfa\fP
   119 Behave as if each data line contains the \eD escape sequence; this causes the
   120 alternative matching function, \fBpcre[16|32]_dfa_exec()\fP, to be used instead
   121 of the standard \fBpcre[16|32]_exec()\fP function (more detail is given below).
   122 .TP 10
   123 \fB-help\fP
   124 Output a brief summary these options and then exit.
   125 .TP 10
   126 \fB-i\fP
   127 Behave as if each pattern has the \fB/I\fP modifier; information about the
   128 compiled pattern is given after compilation.
   129 .TP 10
   130 \fB-M\fP
   131 Behave as if each data line contains the \eM escape sequence; this causes
   132 PCRE to discover the minimum MATCH_LIMIT and MATCH_LIMIT_RECURSION settings by
   133 calling \fBpcre[16|32]_exec()\fP repeatedly with different limits.
   134 .TP 10
   135 \fB-m\fP
   136 Output the size of each compiled pattern after it has been compiled. This is
   137 equivalent to adding \fB/M\fP to each regular expression. The size is given in
   138 bytes for both libraries.
   139 .TP 10
   140 \fB-o\fP \fIosize\fP
   141 Set the number of elements in the output vector that is used when calling
   142 \fBpcre[16|32]_exec()\fP or \fBpcre[16|32]_dfa_exec()\fP to be \fIosize\fP. The
   143 default value is 45, which is enough for 14 capturing subexpressions for
   144 \fBpcre[16|32]_exec()\fP or 22 different matches for
   145 \fBpcre[16|32]_dfa_exec()\fP.
   146 The vector size can be changed for individual matching calls by including \eO
   147 in the data line (see below).
   148 .TP 10
   149 \fB-p\fP
   150 Behave as if each pattern has the \fB/P\fP modifier; the POSIX wrapper API is
   151 used to call PCRE. None of the other options has any effect when \fB-p\fP is
   152 set. This option can be used only with the 8-bit library.
   153 .TP 10
   154 \fB-q\fP
   155 Do not output the version number of \fBpcretest\fP at the start of execution.
   156 .TP 10
   157 \fB-S\fP \fIsize\fP
   158 On Unix-like systems, set the size of the run-time stack to \fIsize\fP
   159 megabytes.
   160 .TP 10
   161 \fB-s\fP or \fB-s+\fP
   162 Behave as if each pattern has the \fB/S\fP modifier; in other words, force each
   163 pattern to be studied. If \fB-s+\fP is used, all the JIT compile options are
   164 passed to \fBpcre[16|32]_study()\fP, causing just-in-time optimization to be set
   165 up if it is available, for both full and partial matching. Specific JIT compile
   166 options can be selected by following \fB-s+\fP with a digit in the range 1 to
   167 7, which selects the JIT compile modes as follows:
   168 .sp
   169   1  normal match only
   170   2  soft partial match only
   171   3  normal match and soft partial match
   172   4  hard partial match only
   173   6  soft and hard partial match
   174   7  all three modes (default)
   175 .sp
   176 If \fB-s++\fP is used instead of \fB-s+\fP (with or without a following digit),
   177 the text "(JIT)" is added to the first output line after a match or no match
   178 when JIT-compiled code was actually used.
   179 .sp
   180 Note that there are pattern options that can override \fB-s\fP, either
   181 specifying no studying at all, or suppressing JIT compilation.
   182 .sp
   183 If the \fB/I\fP or \fB/D\fP option is present on a pattern (requesting output
   184 about the compiled pattern), information about the result of studying is not
   185 included when studying is caused only by \fB-s\fP and neither \fB-i\fP nor
   186 \fB-d\fP is present on the command line. This behaviour means that the output
   187 from tests that are run with and without \fB-s\fP should be identical, except
   188 when options that output information about the actual running of a match are
   189 set.
   190 .sp
   191 The \fB-M\fP, \fB-t\fP, and \fB-tm\fP options, which give information about
   192 resources used, are likely to produce different output with and without
   193 \fB-s\fP. Output may also differ if the \fB/C\fP option is present on an
   194 individual pattern. This uses callouts to trace the the matching process, and
   195 this may be different between studied and non-studied patterns. If the pattern
   196 contains (*MARK) items there may also be differences, for the same reason. The
   197 \fB-s\fP command line option can be overridden for specific patterns that
   198 should never be studied (see the \fB/S\fP pattern modifier below).
   199 .TP 10
   200 \fB-t\fP
   201 Run each compile, study, and match many times with a timer, and output
   202 resulting time per compile or match (in milliseconds). Do not set \fB-m\fP with
   203 \fB-t\fP, because you will then get the size output a zillion times, and the
   204 timing will be distorted. You can control the number of iterations that are
   205 used for timing by following \fB-t\fP with a number (as a separate item on the
   206 command line). For example, "-t 1000" would iterate 1000 times. The default is
   207 to iterate 500000 times.
   208 .TP 10
   209 \fB-tm\fP
   210 This is like \fB-t\fP except that it times only the matching phase, not the
   211 compile or study phases.
   212 .
   213 .
   214 .SH DESCRIPTION
   215 .rs
   216 .sp
   217 If \fBpcretest\fP is given two filename arguments, it reads from the first and
   218 writes to the second. If it is given only one filename argument, it reads from
   219 that file and writes to stdout. Otherwise, it reads from stdin and writes to
   220 stdout, and prompts for each line of input, using "re>" to prompt for regular
   221 expressions, and "data>" to prompt for data lines.
   222 .P
   223 When \fBpcretest\fP is built, a configuration option can specify that it should
   224 be linked with the \fBlibreadline\fP library. When this is done, if the input
   225 is from a terminal, it is read using the \fBreadline()\fP function. This
   226 provides line-editing and history facilities. The output from the \fB-help\fP
   227 option states whether or not \fBreadline()\fP will be used.
   228 .P
   229 The program handles any number of sets of input on a single input file. Each
   230 set starts with a regular expression, and continues with any number of data
   231 lines to be matched against the pattern.
   232 .P
   233 Each data line is matched separately and independently. If you want to do
   234 multi-line matches, you have to use the \en escape sequence (or \er or \er\en,
   235 etc., depending on the newline setting) in a single line of input to encode the
   236 newline sequences. There is no limit on the length of data lines; the input
   237 buffer is automatically extended if it is too small.
   238 .P
   239 An empty line signals the end of the data lines, at which point a new regular
   240 expression is read. The regular expressions are given enclosed in any
   241 non-alphanumeric delimiters other than backslash, for example:
   242 .sp
   243   /(a|bc)x+yz/
   244 .sp
   245 White space before the initial delimiter is ignored. A regular expression may
   246 be continued over several input lines, in which case the newline characters are
   247 included within it. It is possible to include the delimiter within the pattern
   248 by escaping it, for example
   249 .sp
   250   /abc\e/def/
   251 .sp
   252 If you do so, the escape and the delimiter form part of the pattern, but since
   253 delimiters are always non-alphanumeric, this does not affect its interpretation.
   254 If the terminating delimiter is immediately followed by a backslash, for
   255 example,
   256 .sp
   257   /abc/\e
   258 .sp
   259 then a backslash is added to the end of the pattern. This is done to provide a
   260 way of testing the error condition that arises if a pattern finishes with a
   261 backslash, because
   262 .sp
   263   /abc\e/
   264 .sp
   265 is interpreted as the first line of a pattern that starts with "abc/", causing
   266 pcretest to read the next line as a continuation of the regular expression.
   267 .
   268 .
   269 .SH "PATTERN MODIFIERS"
   270 .rs
   271 .sp
   272 A pattern may be followed by any number of modifiers, which are mostly single
   273 characters, though some of these can be qualified by further characters.
   274 Following Perl usage, these are referred to below as, for example, "the
   275 \fB/i\fP modifier", even though the delimiter of the pattern need not always be
   276 a slash, and no slash is used when writing modifiers. White space may appear
   277 between the final pattern delimiter and the first modifier, and between the
   278 modifiers themselves. For reference, here is a complete list of modifiers. They
   279 fall into several groups that are described in detail in the following
   280 sections.
   281 .sp
   282   \fB/8\fP              set UTF mode
   283   \fB/?\fP              disable UTF validity check
   284   \fB/+\fP              show remainder of subject after match
   285   \fB/=\fP              show all captures (not just those that are set)
   286 .sp
   287   \fB/A\fP              set PCRE_ANCHORED
   288   \fB/B\fP              show compiled code
   289   \fB/C\fP              set PCRE_AUTO_CALLOUT
   290   \fB/D\fP              same as \fB/B\fP plus \fB/I\fP
   291   \fB/E\fP              set PCRE_DOLLAR_ENDONLY
   292   \fB/F\fP              flip byte order in compiled pattern
   293   \fB/f\fP              set PCRE_FIRSTLINE
   294   \fB/G\fP              find all matches (shorten string)
   295   \fB/g\fP              find all matches (use startoffset)
   296   \fB/I\fP              show information about pattern
   297   \fB/i\fP              set PCRE_CASELESS
   298   \fB/J\fP              set PCRE_DUPNAMES
   299   \fB/K\fP              show backtracking control names
   300   \fB/L\fP              set locale
   301   \fB/M\fP              show compiled memory size
   302   \fB/m\fP              set PCRE_MULTILINE
   303   \fB/N\fP              set PCRE_NO_AUTO_CAPTURE
   304   \fB/P\fP              use the POSIX wrapper
   305   \fB/S\fP              study the pattern after compilation
   306   \fB/s\fP              set PCRE_DOTALL
   307   \fB/T\fP              select character tables
   308   \fB/U\fP              set PCRE_UNGREEDY
   309   \fB/W\fP              set PCRE_UCP
   310   \fB/X\fP              set PCRE_EXTRA
   311   \fB/x\fP              set PCRE_EXTENDED
   312   \fB/Y\fP              set PCRE_NO_START_OPTIMIZE
   313   \fB/Z\fP              don't show lengths in \fB/B\fP output
   314 .sp
   315   \fB/<any>\fP          set PCRE_NEWLINE_ANY
   316   \fB/<anycrlf>\fP      set PCRE_NEWLINE_ANYCRLF
   317   \fB/<cr>\fP           set PCRE_NEWLINE_CR
   318   \fB/<crlf>\fP         set PCRE_NEWLINE_CRLF
   319   \fB/<lf>\fP           set PCRE_NEWLINE_LF
   320   \fB/<bsr_anycrlf>\fP  set PCRE_BSR_ANYCRLF
   321   \fB/<bsr_unicode>\fP  set PCRE_BSR_UNICODE
   322   \fB/<JS>\fP           set PCRE_JAVASCRIPT_COMPAT
   323 .sp
   324 .
   325 .
   326 .SS "Perl-compatible modifiers"
   327 .rs
   328 .sp
   329 The \fB/i\fP, \fB/m\fP, \fB/s\fP, and \fB/x\fP modifiers set the PCRE_CASELESS,
   330 PCRE_MULTILINE, PCRE_DOTALL, or PCRE_EXTENDED options, respectively, when
   331 \fBpcre[16|32]_compile()\fP is called. These four modifier letters have the same
   332 effect as they do in Perl. For example:
   333 .sp
   334   /caseless/i
   335 .sp
   336 .
   337 .
   338 .SS "Modifiers for other PCRE options"
   339 .rs
   340 .sp
   341 The following table shows additional modifiers for setting PCRE compile-time
   342 options that do not correspond to anything in Perl:
   343 .sp
   344   \fB/8\fP              PCRE_UTF8           ) when using the 8-bit
   345   \fB/?\fP              PCRE_NO_UTF8_CHECK  )   library
   346 .sp
   347   \fB/8\fP              PCRE_UTF16          ) when using the 16-bit
   348   \fB/?\fP              PCRE_NO_UTF16_CHECK )   library
   349 .sp
   350   \fB/8\fP              PCRE_UTF32          ) when using the 32-bit
   351   \fB/?\fP              PCRE_NO_UTF32_CHECK )   library
   352 .sp
   353   \fB/A\fP              PCRE_ANCHORED
   354   \fB/C\fP              PCRE_AUTO_CALLOUT
   355   \fB/E\fP              PCRE_DOLLAR_ENDONLY
   356   \fB/f\fP              PCRE_FIRSTLINE
   357   \fB/J\fP              PCRE_DUPNAMES
   358   \fB/N\fP              PCRE_NO_AUTO_CAPTURE
   359   \fB/U\fP              PCRE_UNGREEDY
   360   \fB/W\fP              PCRE_UCP
   361   \fB/X\fP              PCRE_EXTRA
   362   \fB/Y\fP              PCRE_NO_START_OPTIMIZE
   363   \fB/<any>\fP          PCRE_NEWLINE_ANY
   364   \fB/<anycrlf>\fP      PCRE_NEWLINE_ANYCRLF
   365   \fB/<cr>\fP           PCRE_NEWLINE_CR
   366   \fB/<crlf>\fP         PCRE_NEWLINE_CRLF
   367   \fB/<lf>\fP           PCRE_NEWLINE_LF
   368   \fB/<bsr_anycrlf>\fP  PCRE_BSR_ANYCRLF
   369   \fB/<bsr_unicode>\fP  PCRE_BSR_UNICODE
   370   \fB/<JS>\fP           PCRE_JAVASCRIPT_COMPAT
   371 .sp
   372 The modifiers that are enclosed in angle brackets are literal strings as shown,
   373 including the angle brackets, but the letters within can be in either case.
   374 This example sets multiline matching with CRLF as the line ending sequence:
   375 .sp
   376   /^abc/m<CRLF>
   377 .sp
   378 As well as turning on the PCRE_UTF8/16/32 option, the \fB/8\fP modifier causes
   379 all non-printing characters in output strings to be printed using the
   380 \ex{hh...} notation. Otherwise, those less than 0x100 are output in hex without
   381 the curly brackets.
   382 .P
   383 Full details of the PCRE options are given in the
   384 .\" HREF
   385 \fBpcreapi\fP
   386 .\"
   387 documentation.
   388 .
   389 .
   390 .SS "Finding all matches in a string"
   391 .rs
   392 .sp
   393 Searching for all possible matches within each subject string can be requested
   394 by the \fB/g\fP or \fB/G\fP modifier. After finding a match, PCRE is called
   395 again to search the remainder of the subject string. The difference between
   396 \fB/g\fP and \fB/G\fP is that the former uses the \fIstartoffset\fP argument to
   397 \fBpcre[16|32]_exec()\fP to start searching at a new point within the entire
   398 string (which is in effect what Perl does), whereas the latter passes over a
   399 shortened substring. This makes a difference to the matching process if the
   400 pattern begins with a lookbehind assertion (including \eb or \eB).
   401 .P
   402 If any call to \fBpcre[16|32]_exec()\fP in a \fB/g\fP or \fB/G\fP sequence matches
   403 an empty string, the next call is done with the PCRE_NOTEMPTY_ATSTART and
   404 PCRE_ANCHORED flags set in order to search for another, non-empty, match at the
   405 same point. If this second match fails, the start offset is advanced, and the
   406 normal match is retried. This imitates the way Perl handles such cases when
   407 using the \fB/g\fP modifier or the \fBsplit()\fP function. Normally, the start
   408 offset is advanced by one character, but if the newline convention recognizes
   409 CRLF as a newline, and the current character is CR followed by LF, an advance
   410 of two is used.
   411 .
   412 .
   413 .SS "Other modifiers"
   414 .rs
   415 .sp
   416 There are yet more modifiers for controlling the way \fBpcretest\fP
   417 operates.
   418 .P
   419 The \fB/+\fP modifier requests that as well as outputting the substring that
   420 matched the entire pattern, \fBpcretest\fP should in addition output the
   421 remainder of the subject string. This is useful for tests where the subject
   422 contains multiple copies of the same substring. If the \fB+\fP modifier appears
   423 twice, the same action is taken for captured substrings. In each case the
   424 remainder is output on the following line with a plus character following the
   425 capture number. Note that this modifier must not immediately follow the /S
   426 modifier because /S+ and /S++ have other meanings.
   427 .P
   428 The \fB/=\fP modifier requests that the values of all potential captured
   429 parentheses be output after a match. By default, only those up to the highest
   430 one actually used in the match are output (corresponding to the return code
   431 from \fBpcre[16|32]_exec()\fP). Values in the offsets vector corresponding to
   432 higher numbers should be set to -1, and these are output as "<unset>". This
   433 modifier gives a way of checking that this is happening.
   434 .P
   435 The \fB/B\fP modifier is a debugging feature. It requests that \fBpcretest\fP
   436 output a representation of the compiled code after compilation. Normally this
   437 information contains length and offset values; however, if \fB/Z\fP is also
   438 present, this data is replaced by spaces. This is a special feature for use in
   439 the automatic test scripts; it ensures that the same output is generated for
   440 different internal link sizes.
   441 .P
   442 The \fB/D\fP modifier is a PCRE debugging feature, and is equivalent to
   443 \fB/BI\fP, that is, both the \fB/B\fP and the \fB/I\fP modifiers.
   444 .P
   445 The \fB/F\fP modifier causes \fBpcretest\fP to flip the byte order of the
   446 2-byte and 4-byte fields in the compiled pattern. This facility is for testing
   447 the feature in PCRE that allows it to execute patterns that were compiled on a
   448 host with a different endianness. This feature is not available when the POSIX
   449 interface to PCRE is being used, that is, when the \fB/P\fP pattern modifier is
   450 specified. See also the section about saving and reloading compiled patterns
   451 below.
   452 .P
   453 The \fB/I\fP modifier requests that \fBpcretest\fP output information about the
   454 compiled pattern (whether it is anchored, has a fixed first character, and
   455 so on). It does this by calling \fBpcre[16|32]_fullinfo()\fP after compiling a
   456 pattern. If the pattern is studied, the results of that are also output.
   457 .P
   458 The \fB/K\fP modifier requests \fBpcretest\fP to show names from backtracking
   459 control verbs that are returned from calls to \fBpcre[16|32]_exec()\fP. It causes
   460 \fBpcretest\fP to create a \fBpcre[16|32]_extra\fP block if one has not already
   461 been created by a call to \fBpcre[16|32]_study()\fP, and to set the
   462 PCRE_EXTRA_MARK flag and the \fBmark\fP field within it, every time that
   463 \fBpcre[16|32]_exec()\fP is called. If the variable that the \fBmark\fP field
   464 points to is non-NULL for a match, non-match, or partial match, \fBpcretest\fP
   465 prints the string to which it points. For a match, this is shown on a line by
   466 itself, tagged with "MK:". For a non-match it is added to the message.
   467 .P
   468 The \fB/L\fP modifier must be followed directly by the name of a locale, for
   469 example,
   470 .sp
   471   /pattern/Lfr_FR
   472 .sp
   473 For this reason, it must be the last modifier. The given locale is set,
   474 \fBpcre[16|32]_maketables()\fP is called to build a set of character tables for
   475 the locale, and this is then passed to \fBpcre[16|32]_compile()\fP when compiling
   476 the regular expression. Without an \fB/L\fP (or \fB/T\fP) modifier, NULL is
   477 passed as the tables pointer; that is, \fB/L\fP applies only to the expression
   478 on which it appears.
   479 .P
   480 The \fB/M\fP modifier causes the size in bytes of the memory block used to hold
   481 the compiled pattern to be output. This does not include the size of the
   482 \fBpcre[16|32]\fP block; it is just the actual compiled data. If the pattern is
   483 successfully studied with the PCRE_STUDY_JIT_COMPILE option, the size of the
   484 JIT compiled code is also output.
   485 .P
   486 The \fB/S\fP modifier causes \fBpcre[16|32]_study()\fP to be called after the
   487 expression has been compiled, and the results used when the expression is
   488 matched. There are a number of qualifying characters that may follow \fB/S\fP.
   489 They may appear in any order.
   490 .P
   491 If \fBS\fP is followed by an exclamation mark, \fBpcre[16|32]_study()\fP is called
   492 with the PCRE_STUDY_EXTRA_NEEDED option, causing it always to return a
   493 \fBpcre_extra\fP block, even when studying discovers no useful information.
   494 .P
   495 If \fB/S\fP is followed by a second S character, it suppresses studying, even
   496 if it was requested externally by the \fB-s\fP command line option. This makes
   497 it possible to specify that certain patterns are always studied, and others are
   498 never studied, independently of \fB-s\fP. This feature is used in the test
   499 files in a few cases where the output is different when the pattern is studied.
   500 .P
   501 If the \fB/S\fP modifier is followed by a + character, the call to
   502 \fBpcre[16|32]_study()\fP is made with all the JIT study options, requesting
   503 just-in-time optimization support if it is available, for both normal and
   504 partial matching. If you want to restrict the JIT compiling modes, you can
   505 follow \fB/S+\fP with a digit in the range 1 to 7:
   506 .sp
   507   1  normal match only
   508   2  soft partial match only
   509   3  normal match and soft partial match
   510   4  hard partial match only
   511   6  soft and hard partial match
   512   7  all three modes (default)
   513 .sp
   514 If \fB/S++\fP is used instead of \fB/S+\fP (with or without a following digit),
   515 the text "(JIT)" is added to the first output line after a match or no match
   516 when JIT-compiled code was actually used.
   517 .P
   518 Note that there is also an independent \fB/+\fP modifier; it must not be given
   519 immediately after \fB/S\fP or \fB/S+\fP because this will be misinterpreted.
   520 .P
   521 If JIT studying is successful, the compiled JIT code will automatically be used
   522 when \fBpcre[16|32]_exec()\fP is run, except when incompatible run-time options
   523 are specified. For more details, see the
   524 .\" HREF
   525 \fBpcrejit\fP
   526 .\"
   527 documentation. See also the \fB\eJ\fP escape sequence below for a way of
   528 setting the size of the JIT stack.
   529 .P
   530 Finally, if \fB/S\fP is followed by a minus character, JIT compilation is
   531 suppressed, even if it was requested externally by the \fB-s\fP command line
   532 option. This makes it possible to specify that JIT is never to be used for
   533 certain patterns.
   534 .P
   535 The \fB/T\fP modifier must be followed by a single digit. It causes a specific
   536 set of built-in character tables to be passed to \fBpcre[16|32]_compile()\fP. It
   537 is used in the standard PCRE tests to check behaviour with different character
   538 tables. The digit specifies the tables as follows:
   539 .sp
   540   0   the default ASCII tables, as distributed in
   541         pcre_chartables.c.dist
   542   1   a set of tables defining ISO 8859 characters
   543 .sp
   544 In table 1, some characters whose codes are greater than 128 are identified as
   545 letters, digits, spaces, etc.
   546 .
   547 .
   548 .SS "Using the POSIX wrapper API"
   549 .rs
   550 .sp
   551 The \fB/P\fP modifier causes \fBpcretest\fP to call PCRE via the POSIX wrapper
   552 API rather than its native API. This supports only the 8-bit library. When
   553 \fB/P\fP is set, the following modifiers set options for the \fBregcomp()\fP
   554 function:
   555 .sp
   556   /i    REG_ICASE
   557   /m    REG_NEWLINE
   558   /N    REG_NOSUB
   559   /s    REG_DOTALL     )
   560   /U    REG_UNGREEDY   ) These options are not part of
   561   /W    REG_UCP        )   the POSIX standard
   562   /8    REG_UTF8       )
   563 .sp
   564 The \fB/+\fP modifier works as described above. All other modifiers are
   565 ignored.
   566 .
   567 .
   568 .SH "DATA LINES"
   569 .rs
   570 .sp
   571 Before each data line is passed to \fBpcre[16|32]_exec()\fP, leading and trailing
   572 white space is removed, and it is then scanned for \e escapes. Some of these
   573 are pretty esoteric features, intended for checking out some of the more
   574 complicated features of PCRE. If you are just testing "ordinary" regular
   575 expressions, you probably don't need any of these. The following escapes are
   576 recognized:
   577 .sp
   578   \ea         alarm (BEL, \ex07)
   579   \eb         backspace (\ex08)
   580   \ee         escape (\ex27)
   581   \ef         form feed (\ex0c)
   582   \en         newline (\ex0a)
   583 .\" JOIN
   584   \eqdd       set the PCRE_MATCH_LIMIT limit to dd
   585                (any number of digits)
   586   \er         carriage return (\ex0d)
   587   \et         tab (\ex09)
   588   \ev         vertical tab (\ex0b)
   589   \ennn       octal character (up to 3 octal digits); always
   590                a byte unless > 255 in UTF-8 or 16-bit or 32-bit mode
   591   \exhh       hexadecimal byte (up to 2 hex digits)
   592   \ex{hh...}  hexadecimal character (any number of hex digits)
   593 .\" JOIN
   594   \eA         pass the PCRE_ANCHORED option to \fBpcre[16|32]_exec()\fP
   595                or \fBpcre[16|32]_dfa_exec()\fP
   596 .\" JOIN
   597   \eB         pass the PCRE_NOTBOL option to \fBpcre[16|32]_exec()\fP
   598                or \fBpcre[16|32]_dfa_exec()\fP
   599 .\" JOIN
   600   \eCdd       call pcre[16|32]_copy_substring() for substring dd
   601                after a successful match (number less than 32)
   602 .\" JOIN
   603   \eCname     call pcre[16|32]_copy_named_substring() for substring
   604                "name" after a successful match (name termin-
   605                ated by next non alphanumeric character)
   606 .\" JOIN
   607   \eC+        show the current captured substrings at callout
   608                time
   609   \eC-        do not supply a callout function
   610 .\" JOIN
   611   \eC!n       return 1 instead of 0 when callout number n is
   612                reached
   613 .\" JOIN
   614   \eC!n!m     return 1 instead of 0 when callout number n is
   615                reached for the nth time
   616 .\" JOIN
   617   \eC*n       pass the number n (may be negative) as callout
   618                data; this is used as the callout return value
   619   \eD         use the \fBpcre[16|32]_dfa_exec()\fP match function
   620   \eF         only shortest match for \fBpcre[16|32]_dfa_exec()\fP
   621 .\" JOIN
   622   \eGdd       call pcre[16|32]_get_substring() for substring dd
   623                after a successful match (number less than 32)
   624 .\" JOIN
   625   \eGname     call pcre[16|32]_get_named_substring() for substring
   626                "name" after a successful match (name termin-
   627                ated by next non-alphanumeric character)
   628 .\" JOIN
   629   \eJdd       set up a JIT stack of dd kilobytes maximum (any
   630                number of digits)
   631 .\" JOIN
   632   \eL         call pcre[16|32]_get_substringlist() after a
   633                successful match
   634 .\" JOIN
   635   \eM         discover the minimum MATCH_LIMIT and
   636                MATCH_LIMIT_RECURSION settings
   637 .\" JOIN
   638   \eN         pass the PCRE_NOTEMPTY option to \fBpcre[16|32]_exec()\fP
   639                or \fBpcre[16|32]_dfa_exec()\fP; if used twice, pass the
   640                PCRE_NOTEMPTY_ATSTART option
   641 .\" JOIN
   642   \eOdd       set the size of the output vector passed to
   643                \fBpcre[16|32]_exec()\fP to dd (any number of digits)
   644 .\" JOIN
   645   \eP         pass the PCRE_PARTIAL_SOFT option to \fBpcre[16|32]_exec()\fP
   646                or \fBpcre[16|32]_dfa_exec()\fP; if used twice, pass the
   647                PCRE_PARTIAL_HARD option
   648 .\" JOIN
   649   \eQdd       set the PCRE_MATCH_LIMIT_RECURSION limit to dd
   650                (any number of digits)
   651   \eR         pass the PCRE_DFA_RESTART option to \fBpcre[16|32]_dfa_exec()\fP
   652   \eS         output details of memory get/free calls during matching
   653 .\" JOIN
   654   \eY         pass the PCRE_NO_START_OPTIMIZE option to \fBpcre[16|32]_exec()\fP
   655                or \fBpcre[16|32]_dfa_exec()\fP
   656 .\" JOIN
   657   \eZ         pass the PCRE_NOTEOL option to \fBpcre[16|32]_exec()\fP
   658                or \fBpcre[16|32]_dfa_exec()\fP
   659 .\" JOIN
   660   \e?         pass the PCRE_NO_UTF[8|16|32]_CHECK option to
   661                \fBpcre[16|32]_exec()\fP or \fBpcre[16|32]_dfa_exec()\fP
   662 .\" JOIN
   663   \e>dd       start the match at offset dd (optional "-"; then
   664                any number of digits); this sets the \fIstartoffset\fP
   665                argument for \fBpcre[16|32]_exec()\fP or \fBpcre[16|32]_dfa_exec()\fP
   666 .\" JOIN
   667   \e<cr>      pass the PCRE_NEWLINE_CR option to \fBpcre[16|32]_exec()\fP
   668                or \fBpcre[16|32]_dfa_exec()\fP
   669 .\" JOIN
   670   \e<lf>      pass the PCRE_NEWLINE_LF option to \fBpcre[16|32]_exec()\fP
   671                or \fBpcre[16|32]_dfa_exec()\fP
   672 .\" JOIN
   673   \e<crlf>    pass the PCRE_NEWLINE_CRLF option to \fBpcre[16|32]_exec()\fP
   674                or \fBpcre[16|32]_dfa_exec()\fP
   675 .\" JOIN
   676   \e<anycrlf> pass the PCRE_NEWLINE_ANYCRLF option to \fBpcre[16|32]_exec()\fP
   677                or \fBpcre[16|32]_dfa_exec()\fP
   678 .\" JOIN
   679   \e<any>     pass the PCRE_NEWLINE_ANY option to \fBpcre[16|32]_exec()\fP
   680                or \fBpcre[16|32]_dfa_exec()\fP
   681 .sp
   682 The use of \ex{hh...} is not dependent on the use of the \fB/8\fP modifier on
   683 the pattern. It is recognized always. There may be any number of hexadecimal
   684 digits inside the braces; invalid values provoke error messages.
   685 .P
   686 Note that \exhh specifies one byte rather than one character in UTF-8 mode;
   687 this makes it possible to construct invalid UTF-8 sequences for testing
   688 purposes. On the other hand, \ex{hh} is interpreted as a UTF-8 character in
   689 UTF-8 mode, generating more than one byte if the value is greater than 127.
   690 When testing the 8-bit library not in UTF-8 mode, \ex{hh} generates one byte
   691 for values less than 256, and causes an error for greater values.
   692 .P
   693 In UTF-16 mode, all 4-digit \ex{hhhh} values are accepted. This makes it
   694 possible to construct invalid UTF-16 sequences for testing purposes.
   695 .P
   696 In UTF-32 mode, all 4- to 8-digit \ex{...} values are accepted. This makes it
   697 possible to construct invalid UTF-32 sequences for testing purposes.
   698 .P
   699 The escapes that specify line ending sequences are literal strings, exactly as
   700 shown. No more than one newline setting should be present in any data line.
   701 .P
   702 A backslash followed by anything else just escapes the anything else. If
   703 the very last character is a backslash, it is ignored. This gives a way of
   704 passing an empty line as data, since a real empty line terminates the data
   705 input.
   706 .P
   707 The \fB\eJ\fP escape provides a way of setting the maximum stack size that is
   708 used by the just-in-time optimization code. It is ignored if JIT optimization
   709 is not being used. Providing a stack that is larger than the default 32K is
   710 necessary only for very complicated patterns.
   711 .P
   712 If \eM is present, \fBpcretest\fP calls \fBpcre[16|32]_exec()\fP several times,
   713 with different values in the \fImatch_limit\fP and \fImatch_limit_recursion\fP
   714 fields of the \fBpcre[16|32]_extra\fP data structure, until it finds the minimum
   715 numbers for each parameter that allow \fBpcre[16|32]_exec()\fP to complete without
   716 error. Because this is testing a specific feature of the normal interpretive
   717 \fBpcre[16|32]_exec()\fP execution, the use of any JIT optimization that might
   718 have been set up by the \fB/S+\fP qualifier of \fB-s+\fP option is disabled.
   719 .P
   720 The \fImatch_limit\fP number is a measure of the amount of backtracking
   721 that takes place, and checking it out can be instructive. For most simple
   722 matches, the number is quite small, but for patterns with very large numbers of
   723 matching possibilities, it can become large very quickly with increasing length
   724 of subject string. The \fImatch_limit_recursion\fP number is a measure of how
   725 much stack (or, if PCRE is compiled with NO_RECURSE, how much heap) memory is
   726 needed to complete the match attempt.
   727 .P
   728 When \eO is used, the value specified may be higher or lower than the size set
   729 by the \fB-O\fP command line option (or defaulted to 45); \eO applies only to
   730 the call of \fBpcre[16|32]_exec()\fP for the line in which it appears.
   731 .P
   732 If the \fB/P\fP modifier was present on the pattern, causing the POSIX wrapper
   733 API to be used, the only option-setting sequences that have any effect are \eB,
   734 \eN, and \eZ, causing REG_NOTBOL, REG_NOTEMPTY, and REG_NOTEOL, respectively,
   735 to be passed to \fBregexec()\fP.
   736 .
   737 .
   738 .SH "THE ALTERNATIVE MATCHING FUNCTION"
   739 .rs
   740 .sp
   741 By default, \fBpcretest\fP uses the standard PCRE matching function,
   742 \fBpcre[16|32]_exec()\fP to match each data line. PCRE also supports an
   743 alternative matching function, \fBpcre[16|32]_dfa_test()\fP, which operates in a
   744 different way, and has some restrictions. The differences between the two
   745 functions are described in the
   746 .\" HREF
   747 \fBpcrematching\fP
   748 .\"
   749 documentation.
   750 .P
   751 If a data line contains the \eD escape sequence, or if the command line
   752 contains the \fB-dfa\fP option, the alternative matching function is used.
   753 This function finds all possible matches at a given point. If, however, the \eF
   754 escape sequence is present in the data line, it stops after the first match is
   755 found. This is always the shortest possible match.
   756 .
   757 .
   758 .SH "DEFAULT OUTPUT FROM PCRETEST"
   759 .rs
   760 .sp
   761 This section describes the output when the normal matching function,
   762 \fBpcre[16|32]_exec()\fP, is being used.
   763 .P
   764 When a match succeeds, \fBpcretest\fP outputs the list of captured substrings
   765 that \fBpcre[16|32]_exec()\fP returns, starting with number 0 for the string that
   766 matched the whole pattern. Otherwise, it outputs "No match" when the return is
   767 PCRE_ERROR_NOMATCH, and "Partial match:" followed by the partially matching
   768 substring when \fBpcre[16|32]_exec()\fP returns PCRE_ERROR_PARTIAL. (Note that
   769 this is the entire substring that was inspected during the partial match; it
   770 may include characters before the actual match start if a lookbehind assertion,
   771 \eK, \eb, or \eB was involved.) For any other return, \fBpcretest\fP outputs
   772 the PCRE negative error number and a short descriptive phrase. If the error is
   773 a failed UTF string check, the offset of the start of the failing character and
   774 the reason code are also output, provided that the size of the output vector is
   775 at least two. Here is an example of an interactive \fBpcretest\fP run.
   776 .sp
   777   $ pcretest
   778   PCRE version 8.13 2011-04-30
   779 .sp
   780     re> /^abc(\ed+)/
   781   data> abc123
   782    0: abc123
   783    1: 123
   784   data> xyz
   785   No match
   786 .sp
   787 Unset capturing substrings that are not followed by one that is set are not
   788 returned by \fBpcre[16|32]_exec()\fP, and are not shown by \fBpcretest\fP. In the
   789 following example, there are two capturing substrings, but when the first data
   790 line is matched, the second, unset substring is not shown. An "internal" unset
   791 substring is shown as "<unset>", as for the second data line.
   792 .sp
   793     re> /(a)|(b)/
   794   data> a
   795    0: a
   796    1: a
   797   data> b
   798    0: b
   799    1: <unset>
   800    2: b
   801 .sp
   802 If the strings contain any non-printing characters, they are output as \exhh
   803 escapes if the value is less than 256 and UTF mode is not set. Otherwise they
   804 are output as \ex{hh...} escapes. See below for the definition of non-printing
   805 characters. If the pattern has the \fB/+\fP modifier, the output for substring
   806 0 is followed by the the rest of the subject string, identified by "0+" like
   807 this:
   808 .sp
   809     re> /cat/+
   810   data> cataract
   811    0: cat
   812    0+ aract
   813 .sp
   814 If the pattern has the \fB/g\fP or \fB/G\fP modifier, the results of successive
   815 matching attempts are output in sequence, like this:
   816 .sp
   817     re> /\eBi(\ew\ew)/g
   818   data> Mississippi
   819    0: iss
   820    1: ss
   821    0: iss
   822    1: ss
   823    0: ipp
   824    1: pp
   825 .sp
   826 "No match" is output only if the first match attempt fails. Here is an example
   827 of a failure message (the offset 4 that is specified by \e>4 is past the end of
   828 the subject string):
   829 .sp
   830     re> /xyz/
   831   data> xyz\e>4
   832   Error -24 (bad offset value)
   833 .P
   834 If any of the sequences \fB\eC\fP, \fB\eG\fP, or \fB\eL\fP are present in a
   835 data line that is successfully matched, the substrings extracted by the
   836 convenience functions are output with C, G, or L after the string number
   837 instead of a colon. This is in addition to the normal full list. The string
   838 length (that is, the return from the extraction function) is given in
   839 parentheses after each string for \fB\eC\fP and \fB\eG\fP.
   840 .P
   841 Note that whereas patterns can be continued over several lines (a plain ">"
   842 prompt is used for continuations), data lines may not. However newlines can be
   843 included in data by means of the \en escape (or \er, \er\en, etc., depending on
   844 the newline sequence setting).
   845 .
   846 .
   847 .
   848 .SH "OUTPUT FROM THE ALTERNATIVE MATCHING FUNCTION"
   849 .rs
   850 .sp
   851 When the alternative matching function, \fBpcre[16|32]_dfa_exec()\fP, is used (by
   852 means of the \eD escape sequence or the \fB-dfa\fP command line option), the
   853 output consists of a list of all the matches that start at the first point in
   854 the subject where there is at least one match. For example:
   855 .sp
   856     re> /(tang|tangerine|tan)/
   857   data> yellow tangerine\eD
   858    0: tangerine
   859    1: tang
   860    2: tan
   861 .sp
   862 (Using the normal matching function on this data finds only "tang".) The
   863 longest matching string is always given first (and numbered zero). After a
   864 PCRE_ERROR_PARTIAL return, the output is "Partial match:", followed by the
   865 partially matching substring. (Note that this is the entire substring that was
   866 inspected during the partial match; it may include characters before the actual
   867 match start if a lookbehind assertion, \eK, \eb, or \eB was involved.)
   868 .P
   869 If \fB/g\fP is present on the pattern, the search for further matches resumes
   870 at the end of the longest match. For example:
   871 .sp
   872     re> /(tang|tangerine|tan)/g
   873   data> yellow tangerine and tangy sultana\eD
   874    0: tangerine
   875    1: tang
   876    2: tan
   877    0: tang
   878    1: tan
   879    0: tan
   880 .sp
   881 Since the matching function does not support substring capture, the escape
   882 sequences that are concerned with captured substrings are not relevant.
   883 .
   884 .
   885 .SH "RESTARTING AFTER A PARTIAL MATCH"
   886 .rs
   887 .sp
   888 When the alternative matching function has given the PCRE_ERROR_PARTIAL return,
   889 indicating that the subject partially matched the pattern, you can restart the
   890 match with additional subject data by means of the \eR escape sequence. For
   891 example:
   892 .sp
   893     re> /^\ed?\ed(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\ed\ed$/
   894   data> 23ja\eP\eD
   895   Partial match: 23ja
   896   data> n05\eR\eD
   897    0: n05
   898 .sp
   899 For further information about partial matching, see the
   900 .\" HREF
   901 \fBpcrepartial\fP
   902 .\"
   903 documentation.
   904 .
   905 .
   906 .SH CALLOUTS
   907 .rs
   908 .sp
   909 If the pattern contains any callout requests, \fBpcretest\fP's callout function
   910 is called during matching. This works with both matching functions. By default,
   911 the called function displays the callout number, the start and current
   912 positions in the text at the callout time, and the next pattern item to be
   913 tested. For example:
   914 .sp
   915   --->pqrabcdef
   916     0    ^  ^     \ed
   917 .sp
   918 This output indicates that callout number 0 occurred for a match attempt
   919 starting at the fourth character of the subject string, when the pointer was at
   920 the seventh character of the data, and when the next pattern item was \ed. Just
   921 one circumflex is output if the start and current positions are the same.
   922 .P
   923 Callouts numbered 255 are assumed to be automatic callouts, inserted as a
   924 result of the \fB/C\fP pattern modifier. In this case, instead of showing the
   925 callout number, the offset in the pattern, preceded by a plus, is output. For
   926 example:
   927 .sp
   928     re> /\ed?[A-E]\e*/C
   929   data> E*
   930   --->E*
   931    +0 ^      \ed?
   932    +3 ^      [A-E]
   933    +8 ^^     \e*
   934   +10 ^ ^
   935    0: E*
   936 .sp
   937 If a pattern contains (*MARK) items, an additional line is output whenever
   938 a change of latest mark is passed to the callout function. For example:
   939 .sp
   940     re> /a(*MARK:X)bc/C
   941   data> abc
   942   --->abc
   943    +0 ^       a
   944    +1 ^^      (*MARK:X)
   945   +10 ^^      b
   946   Latest Mark: X
   947   +11 ^ ^     c
   948   +12 ^  ^
   949    0: abc
   950 .sp
   951 The mark changes between matching "a" and "b", but stays the same for the rest
   952 of the match, so nothing more is output. If, as a result of backtracking, the
   953 mark reverts to being unset, the text "<unset>" is output.
   954 .P
   955 The callout function in \fBpcretest\fP returns zero (carry on matching) by
   956 default, but you can use a \eC item in a data line (as described above) to
   957 change this and other parameters of the callout.
   958 .P
   959 Inserting callouts can be helpful when using \fBpcretest\fP to check
   960 complicated regular expressions. For further information about callouts, see
   961 the
   962 .\" HREF
   963 \fBpcrecallout\fP
   964 .\"
   965 documentation.
   966 .
   967 .
   968 .
   969 .SH "NON-PRINTING CHARACTERS"
   970 .rs
   971 .sp
   972 When \fBpcretest\fP is outputting text in the compiled version of a pattern,
   973 bytes other than 32-126 are always treated as non-printing characters are are
   974 therefore shown as hex escapes.
   975 .P
   976 When \fBpcretest\fP is outputting text that is a matched part of a subject
   977 string, it behaves in the same way, unless a different locale has been set for
   978 the pattern (using the \fB/L\fP modifier). In this case, the \fBisprint()\fP
   979 function to distinguish printing and non-printing characters.
   980 .
   981 .
   982 .
   983 .SH "SAVING AND RELOADING COMPILED PATTERNS"
   984 .rs
   985 .sp
   986 The facilities described in this section are not available when the POSIX
   987 interface to PCRE is being used, that is, when the \fB/P\fP pattern modifier is
   988 specified.
   989 .P
   990 When the POSIX interface is not in use, you can cause \fBpcretest\fP to write a
   991 compiled pattern to a file, by following the modifiers with > and a file name.
   992 For example:
   993 .sp
   994   /pattern/im >/some/file
   995 .sp
   996 See the
   997 .\" HREF
   998 \fBpcreprecompile\fP
   999 .\"
  1000 documentation for a discussion about saving and re-using compiled patterns.
  1001 Note that if the pattern was successfully studied with JIT optimization, the
  1002 JIT data cannot be saved.
  1003 .P
  1004 The data that is written is binary. The first eight bytes are the length of the
  1005 compiled pattern data followed by the length of the optional study data, each
  1006 written as four bytes in big-endian order (most significant byte first). If
  1007 there is no study data (either the pattern was not studied, or studying did not
  1008 return any data), the second length is zero. The lengths are followed by an
  1009 exact copy of the compiled pattern. If there is additional study data, this
  1010 (excluding any JIT data) follows immediately after the compiled pattern. After
  1011 writing the file, \fBpcretest\fP expects to read a new pattern.
  1012 .P
  1013 A saved pattern can be reloaded into \fBpcretest\fP by specifying < and a file
  1014 name instead of a pattern. The name of the file must not contain a < character,
  1015 as otherwise \fBpcretest\fP will interpret the line as a pattern delimited by <
  1016 characters.
  1017 For example:
  1018 .sp
  1019    re> </some/file
  1020   Compiled pattern loaded from /some/file
  1021   No study data
  1022 .sp
  1023 If the pattern was previously studied with the JIT optimization, the JIT
  1024 information cannot be saved and restored, and so is lost. When the pattern has
  1025 been loaded, \fBpcretest\fP proceeds to read data lines in the usual way.
  1026 .P
  1027 You can copy a file written by \fBpcretest\fP to a different host and reload it
  1028 there, even if the new host has opposite endianness to the one on which the
  1029 pattern was compiled. For example, you can compile on an i86 machine and run on
  1030 a SPARC machine. When a pattern is reloaded on a host with different
  1031 endianness, the confirmation message is changed to:
  1032 .sp
  1033   Compiled pattern (byte-inverted) loaded from /some/file
  1034 .sp
  1035 The test suite contains some saved pre-compiled patterns with different
  1036 endianness. These are reloaded using "<!" instead of just "<". This suppresses
  1037 the "(byte-inverted)" text so that the output is the same on all hosts. It also
  1038 forces debugging output once the pattern has been reloaded.
  1039 .P
  1040 File names for saving and reloading can be absolute or relative, but note that
  1041 the shell facility of expanding a file name that starts with a tilde (~) is not
  1042 available.
  1043 .P
  1044 The ability to save and reload files in \fBpcretest\fP is intended for testing
  1045 and experimentation. It is not intended for production use because only a
  1046 single pattern can be written to a file. Furthermore, there is no facility for
  1047 supplying custom character tables for use with a reloaded pattern. If the
  1048 original pattern was compiled with custom tables, an attempt to match a subject
  1049 string using a reloaded pattern is likely to cause \fBpcretest\fP to crash.
  1050 Finally, if you attempt to load a file that is not in the correct format, the
  1051 result is undefined.
  1052 .
  1053 .
  1054 .SH "SEE ALSO"
  1055 .rs
  1056 .sp
  1057 \fBpcre\fP(3), \fBpcre16\fP(3), \fBpcre32\fP(3), \fBpcreapi\fP(3),
  1058 \fBpcrecallout\fP(3),
  1059 \fBpcrejit\fP, \fBpcrematching\fP(3), \fBpcrepartial\fP(d),
  1060 \fBpcrepattern\fP(3), \fBpcreprecompile\fP(3).
  1061 .
  1062 .
  1063 .SH AUTHOR
  1064 .rs
  1065 .sp
  1066 .nf
  1067 Philip Hazel
  1068 University Computing Service
  1069 Cambridge CB2 3QH, England.
  1070 .fi
  1071 .
  1072 .
  1073 .SH REVISION
  1074 .rs
  1075 .sp
  1076 .nf
  1077 Last updated: 10 September 2012
  1078 Copyright (c) 1997-2012 University of Cambridge.
  1079 .fi