| 1 |
README file for PCRE (Perl-compatible regular expression library) |
README file for PCRE (Perl-compatible regular expression library) |
| 2 |
----------------------------------------------------------------- |
----------------------------------------------------------------- |
| 3 |
|
|
| 4 |
The latest release of PCRE is always available from |
The latest release of PCRE is always available in three alternative formats |
| 5 |
|
from: |
| 6 |
|
|
| 7 |
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-xxx.tar.gz |
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-xxx.tar.gz |
| 8 |
|
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-xxx.tar.bz2 |
| 9 |
|
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-xxx.zip |
| 10 |
|
|
| 11 |
There is a mailing list for discussion about the development of PCRE at |
There is a mailing list for discussion about the development of PCRE at |
| 12 |
|
|
| 106 |
|
|
| 107 |
For a non-Unix system, please read the comments in the file NON-UNIX-USE, |
For a non-Unix system, please read the comments in the file NON-UNIX-USE, |
| 108 |
though if your system supports the use of "configure" and "make" you may be |
though if your system supports the use of "configure" and "make" you may be |
| 109 |
able to build PCRE in the same way as for Unix-like systems. |
able to build PCRE in the same way as for Unix-like systems. PCRE can also be |
| 110 |
|
configured in many platform environments using the GUI facility of CMake's |
| 111 |
|
CMakeSetup. It creates Makefiles, solution files, etc. |
| 112 |
|
|
| 113 |
PCRE has been compiled on many different operating systems. It should be |
PCRE has been compiled on many different operating systems. It should be |
| 114 |
straightforward to build PCRE on any system that has a Standard C compiler and |
straightforward to build PCRE on any system that has a Standard C compiler and |
| 122 |
in the section entitled "Using HP's ANSI C++ compiler (aCC)" below. |
in the section entitled "Using HP's ANSI C++ compiler (aCC)" below. |
| 123 |
|
|
| 124 |
The following instructions assume the use of the widely used "configure, make, |
The following instructions assume the use of the widely used "configure, make, |
| 125 |
make install" process. There is also some experimental support for "cmake" in |
make install" process. There is also support for CMake in the PCRE |
| 126 |
the PCRE distribution, but it is incomplete and not documented. However, if you |
distribution; there are some comments about using CMake in the NON-UNIX-USE |
| 127 |
are a "cmake" user, you might want to try it. |
file, though it can also be used in Unix-like systems. |
| 128 |
|
|
| 129 |
To build PCRE on a Unix-like system, first run the "configure" command from the |
To build PCRE on a Unix-like system, first run the "configure" command from the |
| 130 |
PCRE distribution directory, with your current directory set to the directory |
PCRE distribution directory, with your current directory set to the directory |
| 174 |
supported. |
supported. |
| 175 |
|
|
| 176 |
. You can build PCRE to recognize either CR or LF or the sequence CRLF or any |
. You can build PCRE to recognize either CR or LF or the sequence CRLF or any |
| 177 |
of the Unicode newline sequences as indicating the end of a line. Whatever |
of the preceding, or any of the Unicode newline sequences as indicating the |
| 178 |
you specify at build time is the default; the caller of PCRE can change the |
end of a line. Whatever you specify at build time is the default; the caller |
| 179 |
selection at run time. The default newline indicator is a single LF character |
of PCRE can change the selection at run time. The default newline indicator |
| 180 |
(the Unix standard). You can specify the default newline indicator by adding |
is a single LF character (the Unix standard). You can specify the default |
| 181 |
--newline-is-cr or --newline-is-lf or --newline-is-crlf or --newline-is-any |
newline indicator by adding --enable-newline-is-cr or --enable-newline-is-lf |
| 182 |
to the "configure" command, respectively. |
or --enable-newline-is-crlf or --enable-newline-is-anycrlf or |
| 183 |
|
--enable-newline-is-any to the "configure" command, respectively. |
| 184 |
If you specify --newline-is-cr or --newline-is-crlf, some of the standard |
|
| 185 |
tests will fail, because the lines in the test files end with LF. Even if |
If you specify --enable-newline-is-cr or --enable-newline-is-crlf, some of |
| 186 |
the files are edited to change the line endings, there are likely to be some |
the standard tests will fail, because the lines in the test files end with |
| 187 |
failures. With --newline-is-any, many tests should succeed, but there may be |
LF. Even if the files are edited to change the line endings, there are likely |
| 188 |
some failures. |
to be some failures. With --enable-newline-is-anycrlf or |
| 189 |
|
--enable-newline-is-any, many tests should succeed, but there may be some |
| 190 |
|
failures. |
| 191 |
|
|
| 192 |
|
. By default, the sequence \R in a pattern matches any Unicode line ending |
| 193 |
|
sequence. This is independent of the option specifying what PCRE considers to |
| 194 |
|
be the end of a line (see above). However, the caller of PCRE can restrict \R |
| 195 |
|
to match only CR, LF, or CRLF. You can make this the default by adding |
| 196 |
|
--enable-bsr-anycrlf to the "configure" command (bsr = "backslash R"). |
| 197 |
|
|
| 198 |
. When called via the POSIX interface, PCRE uses malloc() to get additional |
. When called via the POSIX interface, PCRE uses malloc() to get additional |
| 199 |
storage for processing capturing parentheses if there are more than 10 of |
storage for processing capturing parentheses if there are more than 10 of |
| 261 |
|
|
| 262 |
This automatically implies --enable-rebuild-chartables (see above). |
This automatically implies --enable-rebuild-chartables (see above). |
| 263 |
|
|
| 264 |
|
. It is possible to compile pcregrep to use libz and/or libbz2, in order to |
| 265 |
|
read .gz and .bz2 files (respectively), by specifying one or both of |
| 266 |
|
|
| 267 |
|
--enable-pcregrep-libz |
| 268 |
|
--enable-pcregrep-libbz2 |
| 269 |
|
|
| 270 |
|
Of course, the relevant libraries must be installed on your system. |
| 271 |
|
|
| 272 |
|
. It is possible to compile pcretest so that it links with the libreadline |
| 273 |
|
library, by specifying |
| 274 |
|
|
| 275 |
|
--enable-pcretest-libreadline |
| 276 |
|
|
| 277 |
|
If this is done, when pcretest's input is from a terminal, it reads it using |
| 278 |
|
the readline() function. This provides line-editing and history facilities. |
| 279 |
|
Note that libreadline is GPL-licenced, so if you distribute a binary of |
| 280 |
|
pcretest linked in this way, there may be licensing issues. |
| 281 |
|
|
| 282 |
|
Setting this option causes the -lreadline option to be added to the pcretest |
| 283 |
|
build. In many operating environments with a sytem-installed readline |
| 284 |
|
library this is sufficient. However, in some environments (e.g. if an |
| 285 |
|
unmodified distribution version of readline is in use), it may be necessary |
| 286 |
|
to specify something like LIBS="-lncurses" as well. This is because, to quote |
| 287 |
|
the readline INSTALL, "Readline uses the termcap functions, but does not link |
| 288 |
|
with the termcap or curses library itself, allowing applications which link |
| 289 |
|
with readline the to choose an appropriate library." If you get error |
| 290 |
|
messages about missing functions tgetstr, tgetent, tputs, tgetflag, or tgoto, |
| 291 |
|
this is the problem, and linking with the ncurses library should fix it. |
| 292 |
|
|
| 293 |
The "configure" script builds the following files for the basic C library: |
The "configure" script builds the following files for the basic C library: |
| 294 |
|
|
| 295 |
. Makefile is the makefile that builds the library |
. Makefile is the makefile that builds the library |
| 317 |
contains compiler output from tests that "configure" runs. |
contains compiler output from tests that "configure" runs. |
| 318 |
|
|
| 319 |
Once "configure" has run, you can run "make". It builds two libraries, called |
Once "configure" has run, you can run "make". It builds two libraries, called |
| 320 |
libpcre and libpcreposix, a test program called pcretest, a demonstration |
libpcre and libpcreposix, a test program called pcretest, and the pcregrep |
| 321 |
program called pcredemo, and the pcregrep command. If a C++ compiler was found |
command. If a C++ compiler was found on your system, "make" also builds the C++ |
| 322 |
on your system, "make" also builds the C++ wrapper library, which is called |
wrapper library, which is called libpcrecpp, and some test programs called |
| 323 |
libpcrecpp, and some test programs called pcrecpp_unittest, |
pcrecpp_unittest, pcre_scanner_unittest, and pcre_stringpiece_unittest. |
| 324 |
pcre_scanner_unittest, and pcre_stringpiece_unittest. Building the C++ wrapper |
Building the C++ wrapper can be disabled by adding --disable-cpp to the |
| 325 |
can be disabled by adding --disable-cpp to the "configure" command. |
"configure" command. |
| 326 |
|
|
| 327 |
The command "make check" runs all the appropriate tests. Details of the PCRE |
The command "make check" runs all the appropriate tests. Details of the PCRE |
| 328 |
tests are given below in a separate section of this document. |
tests are given below in a separate section of this document. |
| 374 |
pcretest.txt the pcretest man page |
pcretest.txt the pcretest man page |
| 375 |
pcregrep.txt the pcregrep man page |
pcregrep.txt the pcregrep man page |
| 376 |
|
|
|
Note that the pcredemo program that is built by "configure" is *not* installed |
|
|
anywhere. It is a demonstration for programmers wanting to use PCRE. |
|
|
|
|
| 377 |
If you want to remove PCRE from your system, you can run "make uninstall". |
If you want to remove PCRE from your system, you can run "make uninstall". |
| 378 |
This removes all the files that "make install" installed. However, it does not |
This removes all the files that "make install" installed. However, it does not |
| 379 |
remove any directories, because these are often shared with other programs. |
remove any directories, because these are often shared with other programs. |
| 473 |
------------------- |
------------------- |
| 474 |
|
|
| 475 |
The command "make dist" creates three PCRE tarballs, in tar.gz, tar.bz2, and |
The command "make dist" creates three PCRE tarballs, in tar.gz, tar.bz2, and |
| 476 |
zip formats. However, if you have modified any of the man page sources in the |
zip formats. The command "make distcheck" does the same, but then does a trial |
| 477 |
doc directory, you should first run the PrepareRelease script. This re-creates |
build of the new distribution to ensure that it works. |
| 478 |
the .txt and HTML forms of the documentation from the man pages. |
|
| 479 |
|
If you have modified any of the man page sources in the doc directory, you |
| 480 |
|
should first run the PrepareRelease script before making a distribution. This |
| 481 |
|
script creates the .txt and HTML forms of the documentation from the man pages. |
| 482 |
|
|
| 483 |
|
|
| 484 |
Testing PCRE |
Testing PCRE |
| 537 |
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. |
| 538 |
|
|
| 539 |
[If you are trying to run this test on Windows, you may be able to get it to |
[If you are trying to run this test on Windows, you may be able to get it to |
| 540 |
work by changing "fr_FR" to "french" everywhere it occurs.] |
work by changing "fr_FR" to "french" everywhere it occurs. Alternatively, use |
| 541 |
|
RunTest.bat. The version of RunTest.bat included with PCRE 7.4 and above uses |
| 542 |
|
Windows versions of test 2. More info on using RunTest.bat is included in the |
| 543 |
|
document entitled NON-UNIX-USE.] |
| 544 |
|
|
| 545 |
The fourth test checks the UTF-8 support. It is not run automatically unless |
The fourth test checks the UTF-8 support. It is not run automatically unless |
| 546 |
PCRE is built with UTF-8 support. To do this you must set --enable-utf8 when |
PCRE is built with UTF-8 support. To do this you must set --enable-utf8 when |
| 645 |
pcre_study.c ) |
pcre_study.c ) |
| 646 |
pcre_tables.c ) |
pcre_tables.c ) |
| 647 |
pcre_try_flipped.c ) |
pcre_try_flipped.c ) |
| 648 |
pcre_ucp_searchfuncs.c ) |
pcre_ucd.c ) |
| 649 |
pcre_valid_utf8.c ) |
pcre_valid_utf8.c ) |
| 650 |
pcre_version.c ) |
pcre_version.c ) |
| 651 |
pcre_xclass.c ) |
pcre_xclass.c ) |
| 654 |
pcre.h.in template for pcre.h when built by "configure" |
pcre.h.in template for pcre.h when built by "configure" |
| 655 |
pcreposix.h header for the external POSIX wrapper API |
pcreposix.h header for the external POSIX wrapper API |
| 656 |
pcre_internal.h header for internal use |
pcre_internal.h header for internal use |
| 657 |
ucp.h ) headers concerned with |
ucp.h header for Unicode property handling |
|
ucpinternal.h ) Unicode property handling |
|
|
ucptable.h ) (this one is the data table) |
|
| 658 |
|
|
| 659 |
config.h.in template for config.h, which is built by "configure" |
config.h.in template for config.h, which is built by "configure" |
| 660 |
|
|
| 728 |
|
|
| 729 |
(D) Auxiliary files for cmake support |
(D) Auxiliary files for cmake support |
| 730 |
|
|
| 731 |
|
cmake/COPYING-CMAKE-SCRIPTS |
| 732 |
|
cmake/FindPackageHandleStandardArgs.cmake |
| 733 |
|
cmake/FindReadline.cmake |
| 734 |
CMakeLists.txt |
CMakeLists.txt |
| 735 |
config-cmake.h.in |
config-cmake.h.in |
| 736 |
|
|
| 755 |
Philip Hazel |
Philip Hazel |
| 756 |
Email local part: ph10 |
Email local part: ph10 |
| 757 |
Email domain: cam.ac.uk |
Email domain: cam.ac.uk |
| 758 |
Last updated: 29 March 2007 |
Last updated: 27 February 2009 |