/[pcre]/code/trunk/doc/pcretest.txt
ViewVC logotype

Diff of /code/trunk/doc/pcretest.txt

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 41 by nigel, Sat Feb 24 21:39:17 2007 UTC revision 47 by nigel, Sat Feb 24 21:39:29 2007 UTC
# Line 7  experimenting with regular expressions. Line 7  experimenting with regular expressions.
7  If it is given two filename arguments, it reads from the first and writes to  If it is given two filename arguments, it reads from the first and writes to
8  the second. If it is given only one filename argument, it reads from that file  the second. If it is given only one filename argument, it reads from that file
9  and writes to stdout. Otherwise, it reads from stdin and writes to stdout, and  and writes to stdout. Otherwise, it reads from stdin and writes to stdout, and
10  prompts for each line of input.  prompts for each line of input, using "re>" to prompt for regular expressions,
11    and "data>" to prompt for data lines.
12    
13  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
14  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
15  lines to be matched against the pattern. An empty line signals the end of the  lines to be matched against the pattern. An empty line signals the end of the
16  set. The regular expressions are given enclosed in any non-alphameric  data lines, at which point a new regular expression is read. The regular
17  delimiters other than backslash, for example  expressions are given enclosed in any non-alphameric delimiters other than
18    backslash, for example
19    
20    /(a|bc)x+yz/    /(a|bc)x+yz/
21    
22  White space before the initial delimiter is ignored. A regular expression may  White space before the initial delimiter is ignored. A regular expression may
23  be continued over several input lines, in which case the newline characters are  be continued over several input lines, in which case the newline characters are
24  included within it. See the testinput files for many examples. It is possible  included within it. See the test input files in the testdata directory for many
25  to include the delimiter within the pattern by escaping it, for example  examples. It is possible to include the delimiter within the pattern by
26    escaping it, for example
27    
28    /abc\/def/    /abc\/def/
29    
# Line 60  to the matching process if the pattern b Line 63  to the matching process if the pattern b
63  (including \b or \B).  (including \b or \B).
64    
65  If any call to pcre_exec() in a /g or /G sequence matches an empty string, the  If any call to pcre_exec() in a /g or /G sequence matches an empty string, the
66  next call is done with the PCRE_NOTEMPTY flag set so that it cannot match an  next call is done with the PCRE_NOTEMPTY and PCRE_ANCHORED flags set in order
67  empty string again at the same point. If however, this second match fails, the  to search for another, non-empty, match at the same point. If this second match
68  start offset is advanced by one, and the match is retried. This imitates the  fails, the start offset is advanced by one, and the normal match is retried.
69  way Perl handles such cases when using the /g modifier or the split() function.  This imitates the way Perl handles such cases when using the /g modifier or the
70    split() function.
71    
72  There are a number of other modifiers for controlling the way pcretest  There are a number of other modifiers for controlling the way pcretest
73  operates.  operates.
# Line 85  is, /L applies only to the expression on Line 89  is, /L applies only to the expression on
89    
90  The /I modifier requests that pcretest output information about the compiled  The /I modifier requests that pcretest output information about the compiled
91  expression (whether it is anchored, has a fixed first character, and so on). It  expression (whether it is anchored, has a fixed first character, and so on). It
92  does this by calling pcre_info() after compiling an expression, and outputting  does this by calling pcre_fullinfo() after compiling an expression, and
93  the information it gets back. If the pattern is studied, the results of that  outputting the information it gets back. If the pattern is studied, the results
94  are also output.  of that are also output.
95    
96  The /D modifier is a PCRE debugging feature, which also assumes /I. It causes  The /D modifier is a PCRE debugging feature, which also assumes /I. It causes
97  the internal form of compiled regular expressions to be output after  the internal form of compiled regular expressions to be output after

Legend:
Removed from v.41  
changed lines
  Added in v.47

  ViewVC Help
Powered by ViewVC 1.1.5