📄 readme
字号:
README file for PCRE (Perl-compatible regular expression library)-----------------------------------------------------------------The latest release of PCRE is always available from ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-xxx.tar.gzPlease read the NEWS file if you are upgrading from a previous release.PCRE has its own native API, but a set of "wrapper" functions that are based onthe POSIX API are also supplied in the library libpcreposix. Note that thisjust provides a POSIX calling interface to PCRE: the regular expressionsthemselves still follow Perl syntax and semantics. The header filefor the POSIX-style functions is called pcreposix.h. The official POSIX name isregex.h, but I didn't want to risk possible problems with existing files ofthat name by distributing it that way. To use it with an existing program thatuses the POSIX API, it will have to be renamed or pointed at by a link.If you are using the POSIX interface to PCRE and there is already a POSIX regexlibrary installed on your system, you must take care when linking programs toensure that they link with PCRE's libpcreposix library. Otherwise they may pickup the "real" POSIX functions of the same name.Documentation for PCRE----------------------If you install PCRE in the normal way, you will end up with an installed set ofman pages whose names all start with "pcre". The one that is called "pcre"lists all the others. In addition to these man pages, the PCRE documentation issupplied in two other forms; however, as there is no standard place to installthem, they are left in the doc directory of the unpacked source distribution.These forms are: 1. Files called doc/pcre.txt, doc/pcregrep.txt, and doc/pcretest.txt. The first of these is a concatenation of the text forms of all the section 3 man pages except those that summarize individual functions. The other two are the text forms of the section 1 man pages for the pcregrep and pcretest commands. Text forms are provided for ease of scanning with text editors or similar tools. 2. A subdirectory called doc/html contains all the documentation in HTML form, hyperlinked in various ways, and rooted in a file called doc/index.html.Contributions by users of PCRE------------------------------You can find contributions from PCRE users in the directory ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/Contribwhere there is also a README file giving brief descriptions of what they are.Several of them provide support for compiling PCRE on various flavours ofWindows systems (I myself do not use Windows). Some are complete in themselves;others are pointers to URLs containing relevant files.Building PCRE on a Unix-like system-----------------------------------To build PCRE on a Unix-like system, first run the "configure" command from thePCRE distribution directory, with your current directory set to the directorywhere you want the files to be created. This command is a standard GNU"autoconf" configuration script, for which generic instructions are supplied inINSTALL.Most commonly, people build PCRE within its own distribution directory, and inthis case, on many systems, just running "./configure" is sufficient, but theusual methods of changing standard defaults are available. For example:CFLAGS='-O2 -Wall' ./configure --prefix=/opt/localspecifies that the C compiler should be run with the flags '-O2 -Wall' insteadof the default, and that "make install" should install PCRE under /opt/localinstead of the default /usr/local.If you want to build in a different directory, just run "configure" with thatdirectory as current. For example, suppose you have unpacked the PCRE sourceinto /source/pcre/pcre-xxx, but you want to build it in /build/pcre/pcre-xxx:cd /build/pcre/pcre-xxx/source/pcre/pcre-xxx/configureThere are some optional features that can be included or omitted from the PCRElibrary. You can read more about them in the pcrebuild man page.. If you want to make use of the support for UTF-8 character strings in PCRE, you must add --enable-utf8 to the "configure" command. Without it, the code for handling UTF-8 is not included in the library. (Even when included, it still has to be enabled by an option at run time.). If, in addition to support for UTF-8 character strings, you want to include support for the \P, \p, and \X sequences that recognize Unicode character properties, you must add --enable-unicode-properties to the "configure" command. This adds about 90K to the size of the library (in the form of a property table); only the basic two-letter properties such as Lu are supported.. You can build PCRE to recognized CR or NL as the newline character, instead of whatever your compiler uses for "\n", by adding --newline-is-cr or --newline-is-nl to the "configure" command, respectively. Only do this if you really understand what you are doing. On traditional Unix-like systems, the newline character is NL.. When called via the POSIX interface, PCRE uses malloc() to get additional storage for processing capturing parentheses if there are more than 10 of them. You can increase this threshold by setting, for example, --with-posix-malloc-threshold=20 on the "configure" command.. PCRE has a counter which can be set to limit the amount of resources it uses. If the limit is exceeded during a match, the match fails. The default is ten million. You can change the default by setting, for example, --with-match-limit=500000 on the "configure" command. This is just the default; individual calls to pcre_exec() can supply their own value. There is discussion on the pcreapi man page.. The default maximum compiled pattern size is around 64K. You can increase this by adding --with-link-size=3 to the "configure" command. You can increase it even more by setting --with-link-size=4, but this is unlikely ever to be necessary. If you build PCRE with an increased link size, test 2 (and 5 if you are using UTF-8) will fail. Part of the output of these tests is a representation of the compiled pattern, and this changes with the link size.. You can build PCRE so that its match() function does not call itself recursively. Instead, it uses blocks of data from the heap via special functions pcre_stack_malloc() and pcre_stack_free() to save data that would otherwise be saved on the stack. To build PCRE like this, use --disable-stack-for-recursion on the "configure" command. PCRE runs more slowly in this mode, but it may be necessary in environments with limited stack sizes.The "configure" script builds seven files:. pcre.h is build by copying pcre.in and making substitutions. Makefile is built by copying Makefile.in and making substitutions.. config.h is built by copying config.in and making substitutions.. pcre-config is built by copying pcre-config.in and making substitutions.. libpcre.pc is data for the pkg-config command, built from libpcre.pc.in. libtool is a script that builds shared and/or static libraries. RunTest is a script for running testsOnce "configure" has run, you can run "make". It builds two libraries calledlibpcre and libpcreposix, a test program called pcretest, and the pcregrepcommand. You can use "make install" to copy these, the public header filespcre.h and pcreposix.h, and the man pages to appropriate live directories onyour system, in the normal way.Retrieving configuration information on Unix-like systems---------------------------------------------------------Running "make install" also installs the command pcre-config, which can be usedto recall information about the PCRE configuration and installation. Forexample: pcre-config --versionprints the version number, and pcre-config --libsoutputs information about where the library is installed. This command can beincluded in makefiles for programs that use PCRE, saving the programmer fromhaving to remember too many details.The pkg-config command is another system for saving and retrieving informationabout installed libraries. Instead of separate commands for each library, asingle command is used. For example: pkg-config --cflags pcreThe data is held in *.pc files that are installed in a directory calledpkgconfig.Shared libraries on Unix-like systems-------------------------------------The default distribution builds PCRE as two shared libraries and two staticlibraries, as long as the operating system supports shared libraries. Sharedlibrary support relies on the "libtool" script which is built as part of the"configure" process.The libtool script is used to compile and link both shared and staticlibraries. They are placed in a subdirectory called .libs when they are newlybuilt. The programs pcretest and pcregrep are built to use these uninstalledlibraries (by means of wrapper scripts in the case of shared libraries). Whenyou use "make install" to install shared libraries, pcregrep and pcretest areautomatically re-built to use the newly installed shared libraries before beinginstalled themselves. However, the versions left in the source directory stilluse the uninstalled libraries.To build PCRE using static libraries only you must use --disable-shared whenconfiguring it. For example:./configure --prefix=/usr/gnu --disable-sharedThen run "make" in the usual way. Similarly, you can use --disable-static tobuild only shared libraries.Cross-compiling on a Unix-like system-------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -