| 37 |
|
|
| 38 |
ChangeLog log of changes to the code |
ChangeLog log of changes to the code |
| 39 |
LICENCE conditions for the use of PCRE |
LICENCE conditions for the use of PCRE |
| 40 |
Makefile for building PCRE |
Makefile for building PCRE in Unix systems |
| 41 |
README this file |
README this file |
| 42 |
RunTest a shell script for running tests |
RunTest a Unix shell script for running tests |
| 43 |
Tech.Notes notes on the encoding |
Tech.Notes notes on the encoding |
| 44 |
pcre.3 man page for the functions |
pcre.3 man page source for the functions |
| 45 |
pcreposix.3 man page for the POSIX wrapper API |
pcre.3.txt plain text version |
| 46 |
|
pcre.3.html HTML version |
| 47 |
|
pcreposix.3 man page source for the POSIX wrapper API |
| 48 |
|
pcreposix.3.txt plain text version |
| 49 |
|
pcreposix.3.HTML HTML version |
| 50 |
dftables.c auxiliary program for building chartables.c |
dftables.c auxiliary program for building chartables.c |
| 51 |
get.c ) |
get.c ) |
| 52 |
maketables.c ) |
maketables.c ) |
| 57 |
pcreposix.h header for the external POSIX wrapper API |
pcreposix.h header for the external POSIX wrapper API |
| 58 |
internal.h header for internal use |
internal.h header for internal use |
| 59 |
pcretest.c test program |
pcretest.c test program |
| 60 |
pgrep.1 man page for pgrep |
pgrep.1 man page source for pgrep |
| 61 |
|
pgrep.1.txt plain text version |
| 62 |
|
pgrep.1.HTML HTML version |
| 63 |
pgrep.c source of a grep utility that uses PCRE |
pgrep.c source of a grep utility that uses PCRE |
| 64 |
perltest Perl test program |
perltest Perl test program |
| 65 |
testinput1 test data, compatible with Perl 5.004 and 5.005 |
testinput1 test data, compatible with Perl 5.004 and 5.005 |
| 71 |
testoutput3 test results corresponding to testinput3 |
testoutput3 test results corresponding to testinput3 |
| 72 |
testoutput4 test results corresponding to testinput4 |
testoutput4 test results corresponding to testinput4 |
| 73 |
|
|
| 74 |
To build PCRE, edit Makefile for your system (it is a fairly simple make file, |
To build PCRE on a Unix system, first edit Makefile for your system. It is a |
| 75 |
and there are some comments at the top) and then run it. It builds two |
fairly simple make file, and there are some comments near the top, after the |
| 76 |
libraries called libpcre.a and libpcreposix.a, a test program called pcretest, |
text "On a Unix system". Then run "make". It builds two libraries called |
| 77 |
and the pgrep command. |
libpcre.a and libpcreposix.a, a test program called pcretest, and the pgrep |
| 78 |
|
command. You can use "make install" to copy these, and the public header file |
| 79 |
To test PCRE, run the RunTest script in the pcre directory. This runs pcretest |
pcre.h, to appropriate live directories on your system. These installation |
| 80 |
on each of the testinput files in turn, and compares the output with the |
directories are defined at the top of the Makefile, and you should edit them if |
| 81 |
|
necessary. |
| 82 |
|
|
| 83 |
|
For a non-Unix system, read the comments at the top of Makefile, which give |
| 84 |
|
some hints on what needs to be done. PCRE has been compiled on Windows systems |
| 85 |
|
and on Macintoshes, but I don't know the details as I don't use those systems. |
| 86 |
|
It should be straightforward to build PCRE on any system that has a Standard C |
| 87 |
|
compiler. |
| 88 |
|
|
| 89 |
|
To test PCRE, run the RunTest script in the pcre directory. This can also be |
| 90 |
|
run by "make runtest". It runs the pcretest test program (which is documented |
| 91 |
|
below) on each of the testinput files in turn, and compares the output with the |
| 92 |
contents of the corresponding testoutput file. A file called testtry is used to |
contents of the corresponding testoutput file. A file called testtry is used to |
| 93 |
hold the output from pcretest (which is documented below). |
hold the output from pcretest. To run pcretest on just one of the test files, |
| 94 |
|
give its number as an argument to RunTest, for example: |
|
To run pcretest on just one of the test files, give its number as an argument |
|
|
to RunTest, for example: |
|
| 95 |
|
|
| 96 |
RunTest 3 |
RunTest 3 |
| 97 |
|
|
| 98 |
The first and third test files can also be fed directly into the perltest |
The first and third test files can also be fed directly into the perltest |
| 99 |
program to check that Perl gives the same results. The third file requires the |
script to check that Perl gives the same results. The third file requires the |
| 100 |
additional features of release 5.005, which is why it is kept separate from the |
additional features of release 5.005, which is why it is kept separate from the |
| 101 |
main test input, which needs only Perl 5.004. In the long run, when 5.005 is |
main test input, which needs only Perl 5.004. In the long run, when 5.005 is |
| 102 |
widespread, these two test files may get amalgamated. |
widespread, these two test files may get amalgamated. |
| 118 |
in the comparison output, it means that locale is not available on your system, |
in the comparison output, it means that locale is not available on your system, |
| 119 |
despite being listed by "locale". This does not mean that PCRE is broken. |
despite being listed by "locale". This does not mean that PCRE is broken. |
| 120 |
|
|
|
To install PCRE, copy libpcre.a to any suitable library directory (e.g. |
|
|
/usr/local/lib), pcre.h to any suitable include directory (e.g. |
|
|
/usr/local/include), and pcre.3 to any suitable man directory (e.g. |
|
|
/usr/local/man/man3). |
|
|
|
|
|
To install the pgrep command, copy it to any suitable binary directory, (e.g. |
|
|
/usr/local/bin) and pgrep.1 to any suitable man directory (e.g. |
|
|
/usr/local/man/man1). |
|
|
|
|
| 121 |
PCRE has its own native API, but a set of "wrapper" functions that are based on |
PCRE has its own native API, but a set of "wrapper" functions that are based on |
| 122 |
the POSIX API are also supplied in the library libpcreposix.a. Note that this |
the POSIX API are also supplied in the library libpcreposix.a. Note that this |
| 123 |
just provides a POSIX calling interface to PCRE: the regular expressions |
just provides a POSIX calling interface to PCRE: the regular expressions |
| 259 |
The /S modifier causes pcre_study() to be called after the expression has been |
The /S modifier causes pcre_study() to be called after the expression has been |
| 260 |
compiled, and the results used when the expression is matched. |
compiled, and the results used when the expression is matched. |
| 261 |
|
|
| 262 |
The /M modifier causes information about the size of memory block used to hold |
The /M modifier causes the size of memory block used to hold the compiled |
| 263 |
the compile pattern to be output. |
pattern to be output. |
| 264 |
|
|
| 265 |
Finally, the /P modifier causes pcretest to call PCRE via the POSIX wrapper API |
Finally, the /P modifier causes pcretest to call PCRE via the POSIX wrapper API |
| 266 |
rather than its native API. When this is done, all other modifiers except /i, |
rather than its native API. When this is done, all other modifiers except /i, |
| 289 |
\Gdd call pcre_get_substring() for substring dd after a successful match |
\Gdd call pcre_get_substring() for substring dd after a successful match |
| 290 |
(any decimal number less than 32) |
(any decimal number less than 32) |
| 291 |
\L call pcre_get_substringlist() after a successful match |
\L call pcre_get_substringlist() after a successful match |
| 292 |
|
\N pass the PCRE_NOTEMPTY option to pcre_exec() |
| 293 |
\Odd set the size of the output vector passed to pcre_exec() to dd |
\Odd set the size of the output vector passed to pcre_exec() to dd |
| 294 |
(any number of decimal digits) |
(any number of decimal digits) |
| 295 |
\Z pass the PCRE_NOTEOL option to pcre_exec() |
\Z pass the PCRE_NOTEOL option to pcre_exec() |
| 382 |
input patterns can be followed only by Perl's lower case modifiers. The |
input patterns can be followed only by Perl's lower case modifiers. The |
| 383 |
contents of testinput1 and testinput3 meet this condition. |
contents of testinput1 and testinput3 meet this condition. |
| 384 |
|
|
| 385 |
The data lines are processed as Perl strings, so if they contain $ or @ |
The data lines are processed as Perl double-quoted strings, so if they contain |
| 386 |
characters, these have to be escaped. For this reason, all such characters in |
" \ $ or @ characters, these have to be escaped. For this reason, all such |
| 387 |
testinput1 and testinput3 are escaped so that they can be used for perltest as |
characters in testinput1 and testinput3 are escaped so that they can be used |
| 388 |
well as for pcretest, and the special upper case modifiers such as /A that |
for perltest as well as for pcretest, and the special upper case modifiers such |
| 389 |
pcretest recognizes are not used in these files. The output should be |
as /A that pcretest recognizes are not used in these files. The output should |
| 390 |
identical, apart from the initial identifying banner. |
be identical, apart from the initial identifying banner. |
| 391 |
|
|
| 392 |
The testinput2 and testinput4 files are not suitable for feeding to perltest, |
The testinput2 and testinput4 files are not suitable for feeding to perltest, |
| 393 |
since they do make use of the special upper case modifiers and escapes that |
since they do make use of the special upper case modifiers and escapes that |
| 396 |
them correctly. |
them correctly. |
| 397 |
|
|
| 398 |
Philip Hazel <ph10@cam.ac.uk> |
Philip Hazel <ph10@cam.ac.uk> |
| 399 |
June 1999 |
July 1999 |