Introduction to PCRE

The PCRE package contains Perl Compatible Regular Expression libraries. These are useful for implementing regular expression pattern matching using the same syntax and semantics as Perl 5.

Package information

Installation of PCRE

Install PCRE by running the following commands:

./configure --prefix=/usr --enable-utf8 &&
make &&
make install

If you reinstall grep after installing pcre, grep will get linked against pcre and may cause problems if /usr is a separate mount point. To avoid this, either pass the option --disable-perl-regexp when executing ./configure for grep or move libpcre to /lib as follows.

mv /usr/lib/libpcre.so.* /lib/ &&
ln -sf ../../lib/libpcre.so.0 /usr/lib/libpcre.so

Command explanations

--enable-utf8: This switch includes the code for handling UTF-8 character strings in the library.


The PCRE package contains the libpcre libraries, pcregrep, pcretest and pcre-config.



pcregrep is a grep that understands Perl compatible regular expressions.


pcretest can test your Perl compatible regular expression.


pcre-config is used during the compile process of programs linking to this library.