PCRE_README.html revision 1.1.1.1.2.2 1 1.1.1.1.2.2 snj <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"
2 1.1.1.1.2.2 snj "http://www.w3.org/TR/html4/loose.dtd">
3 1.1.1.1.2.2 snj
4 1.1.1.1.2.2 snj <html>
5 1.1.1.1.2.2 snj
6 1.1.1.1.2.2 snj <head>
7 1.1.1.1.2.2 snj
8 1.1.1.1.2.2 snj <title>Postfix PCRE Support</title>
9 1.1.1.1.2.2 snj
10 1.1.1.1.2.2 snj <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
11 1.1.1.1.2.2 snj
12 1.1.1.1.2.2 snj </head>
13 1.1.1.1.2.2 snj
14 1.1.1.1.2.2 snj <body>
15 1.1.1.1.2.2 snj
16 1.1.1.1.2.2 snj <h1><img src="postfix-logo.jpg" width="203" height="98" ALT="">Postfix PCRE Support</h1>
17 1.1.1.1.2.2 snj
18 1.1.1.1.2.2 snj <hr>
19 1.1.1.1.2.2 snj
20 1.1.1.1.2.2 snj <h2>PCRE (Perl Compatible Regular Expressions) map support</h2>
21 1.1.1.1.2.2 snj
22 1.1.1.1.2.2 snj <p> The optional "pcre" map type allows you to specify regular
23 1.1.1.1.2.2 snj expressions with the PERL style notation such as \s for space and
24 1.1.1.1.2.2 snj \S for non-space. The main benefit, however, is that pcre lookups
25 1.1.1.1.2.2 snj are often faster than regexp lookups. This is because the pcre
26 1.1.1.1.2.2 snj implementation is often more efficient than the POSIX regular
27 1.1.1.1.2.2 snj expression implementation that you find on many systems. </p>
28 1.1.1.1.2.2 snj
29 1.1.1.1.2.2 snj <p> A description of how to use pcre tables, including examples,
30 1.1.1.1.2.2 snj is given in the <a href="pcre_table.5.html">pcre_table(5)</a> manual page. Information about PCRE
31 1.1.1.1.2.2 snj itself can be found at <a href="http://www.pcre.org/">http://www.pcre.org/</a>. </p>
32 1.1.1.1.2.2 snj
33 1.1.1.1.2.2 snj <h2>Building Postfix with PCRE support</h2>
34 1.1.1.1.2.2 snj
35 1.1.1.1.2.2 snj <p> These instructions assume that you build Postfix from source
36 1.1.1.1.2.2 snj code as described in the <a href="INSTALL.html">INSTALL</a> document. Some modification may
37 1.1.1.1.2.2 snj be required if you build Postfix from a vendor-specific source
38 1.1.1.1.2.2 snj package. </p>
39 1.1.1.1.2.2 snj
40 1.1.1.1.2.2 snj <p> Note: to use pcre with Debian GNU/Linux's Postfix, all you
41 1.1.1.1.2.2 snj need is to install the postfix-pcre package and you're done. There
42 1.1.1.1.2.2 snj is no need to recompile Postfix. </p>
43 1.1.1.1.2.2 snj
44 1.1.1.1.2.2 snj <p> In some future, Postfix will have a plug-in interface for adding
45 1.1.1.1.2.2 snj map types. Until then, you need to compile PCRE support into Postfix.
46 1.1.1.1.2.2 snj </p>
47 1.1.1.1.2.2 snj
48 1.1.1.1.2.2 snj <p> First of all, you need the PCRE library (Perl Compatible Regular
49 1.1.1.1.2.2 snj Expressions), which can be obtained from: </p>
50 1.1.1.1.2.2 snj
51 1.1.1.1.2.2 snj <blockquote>
52 1.1.1.1.2.2 snj <a href="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/">ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/</a>.
53 1.1.1.1.2.2 snj </blockquote>
54 1.1.1.1.2.2 snj
55 1.1.1.1.2.2 snj <p> NOTE: pcre versions prior to 2.06 cannot be used. </p>
56 1.1.1.1.2.2 snj
57 1.1.1.1.2.2 snj <p> In order to build Postfix with PCRE support you need to add
58 1.1.1.1.2.2 snj -DHAS_PCRE and a -I for the PCRE include file to CCARGS, and add
59 1.1.1.1.2.2 snj the path to the PCRE library to AUXLIBS, for example: </p>
60 1.1.1.1.2.2 snj
61 1.1.1.1.2.2 snj <blockquote>
62 1.1.1.1.2.2 snj <pre>
63 1.1.1.1.2.2 snj make -f Makefile.init makefiles \
64 1.1.1.1.2.2 snj "CCARGS=-DHAS_PCRE -I/usr/local/include" \
65 1.1.1.1.2.2 snj "AUXLIBS=-L/usr/local/lib -lpcre"
66 1.1.1.1.2.2 snj </pre>
67 1.1.1.1.2.2 snj </blockquote>
68 1.1.1.1.2.2 snj
69 1.1.1.1.2.2 snj <p> Solaris needs run-time path information too: </p>
70 1.1.1.1.2.2 snj
71 1.1.1.1.2.2 snj <blockquote>
72 1.1.1.1.2.2 snj <pre>
73 1.1.1.1.2.2 snj make -f Makefile.init makefiles \
74 1.1.1.1.2.2 snj "CCARGS=-DHAS_PCRE -I/usr/local/include" \
75 1.1.1.1.2.2 snj "AUXLIBS=-L/usr/local/lib -R/usr/local/lib -lpcre"
76 1.1.1.1.2.2 snj </pre>
77 1.1.1.1.2.2 snj </blockquote>
78 1.1.1.1.2.2 snj
79 1.1.1.1.2.2 snj <h2>Things to know</h2>
80 1.1.1.1.2.2 snj
81 1.1.1.1.2.2 snj <ul>
82 1.1.1.1.2.2 snj
83 1.1.1.1.2.2 snj <li> <p> When Postfix searches a <a href="pcre_table.5.html">pcre</a>: or <a href="regexp_table.5.html">regexp</a>: lookup table,
84 1.1.1.1.2.2 snj each pattern is applied to the entire input string. Depending on
85 1.1.1.1.2.2 snj the application, that string is an entire client hostname, an entire
86 1.1.1.1.2.2 snj client IP address, or an entire mail address. Thus, no parent domain
87 1.1.1.1.2.2 snj or parent network search is done, "user@domain" mail addresses are
88 1.1.1.1.2.2 snj not broken up into their user and domain constituent parts, and
89 1.1.1.1.2.2 snj "user+foo" is not broken up into user and foo. </p>
90 1.1.1.1.2.2 snj
91 1.1.1.1.2.2 snj <li> <p> Regular expression tables such as <a href="pcre_table.5.html">pcre</a>: or <a href="regexp_table.5.html">regexp</a>: are
92 1.1.1.1.2.2 snj not allowed to do $number substitution in lookup results that can
93 1.1.1.1.2.2 snj be security sensitive: currently, that restriction applies to the
94 1.1.1.1.2.2 snj local <a href="aliases.5.html">aliases(5)</a> database or the <a href="virtual.8.html">virtual(8)</a> delivery agent tables.
95 1.1.1.1.2.2 snj </p>
96 1.1.1.1.2.2 snj
97 1.1.1.1.2.2 snj </ul>
98 1.1.1.1.2.2 snj
99 1.1.1.1.2.2 snj </body>
100 1.1.1.1.2.2 snj
101 1.1.1.1.2.2 snj </html>
102