5 # format of Postfix PCRE tables
7 # \fBpostmap -q "\fIstring\fB" pcre:/etc/postfix/\fIfilename\fR
9 # \fBpostmap -q - pcre:/etc/postfix/\fIfilename\fR <\fIinputfile\fR
11 # The Postfix mail system uses optional tables for address
12 # rewriting, mail routing, or access control. These tables
13 # are usually in \fBdbm\fR or \fBdb\fR format.
15 # Alternatively, lookup tables can be specified in Perl Compatible
16 # Regular Expression form. In this case, each input is compared
17 # against a list of patterns. When a match is found, the
18 # corresponding result is returned and the search is terminated.
20 # To find out what types of lookup tables your Postfix system
21 # supports use the "\fBpostconf -m\fR" command.
23 # To test lookup tables, use the "\fBpostmap -q\fR" command as
24 # described in the SYNOPSIS above.
28 # With Postfix version 2.2 and earlier specify "\fBpostmap
29 # -fq\fR" to query a table that contains case sensitive
30 # patterns. Patterns are case insensitive by default.
34 # The general form of a PCRE table is:
35 # .IP "\fB/\fIpattern\fB/\fIflags result\fR"
36 # When \fIpattern\fR matches the input string, use
37 # the corresponding \fIresult\fR value.
38 # .IP "\fB!/\fIpattern\fB/\fIflags result\fR"
39 # When \fIpattern\fR does \fBnot\fR match the input string, use
40 # the corresponding \fIresult\fR value.
41 # .IP "\fBif /\fIpattern\fB/\fIflags\fR"
43 # Match the input string against the patterns between \fBif\fR
44 # and \fBendif\fR, if and only if that same input string also matches
45 # \fIpattern\fR. The \fBif\fR..\fBendif\fR can nest.
47 # Note: do not prepend whitespace to patterns inside
48 # \fBif\fR..\fBendif\fR.
50 # This feature is available in Postfix 2.1 and later.
51 # .IP "\fBif !/\fIpattern\fB/\fIflags\fR"
53 # Match the input string against the patterns between \fBif\fR
54 # and \fBendif\fR, if and only if that same input string does \fBnot\fR
55 # match \fIpattern\fR. The \fBif\fR..\fBendif\fR can nest.
57 # Note: do not prepend whitespace to patterns inside
58 # \fBif\fR..\fBendif\fR.
60 # This feature is available in Postfix 2.1 and later.
61 # .IP "blank lines and comments"
62 # Empty lines and whitespace-only lines are ignored, as
63 # are lines whose first non-whitespace character is a `#'.
64 # .IP "multi-line text"
65 # A logical line starts with non-whitespace text. A line that
66 # starts with whitespace continues a logical line.
68 # Each pattern is a perl-like regular expression. The expression
69 # delimiter can be any character, except whitespace or characters
70 # that have special meaning (traditionally the forward slash is used).
71 # The regular expression can contain whitespace.
73 # By default, matching is case-insensitive, and newlines are not
74 # treated as special characters. The behavior is controlled by flags,
75 # which are toggled by appending one or more of the following
76 # characters after the pattern:
77 # .IP "\fBi\fR (default: on)"
78 # Toggles the case sensitivity flag. By default, matching is case
80 # .IP "\fBm\fR (default: off)"
81 # Toggles the PCRE_MULTILINE flag. When this flag is on, the \fB^\fR
82 # and \fB$\fR metacharacters match immediately after and immediately
83 # before a newline character, respectively, in addition to
84 # matching at the start and end of the subject string.
85 # .IP "\fBs\fR (default: on)"
86 # Toggles the PCRE_DOTALL flag. When this flag is on, the \fB.\fR
87 # metacharacter matches the newline character. With
88 # Postfix versions prior to 2.0, The flag is off by
89 # default, which is inconvenient for multi-line message header
91 # .IP "\fBx\fR (default: off)"
92 # Toggles the pcre extended flag. When this flag is on, whitespace
93 # characters in the pattern (other than in a character class)
94 # are ignored. To include a whitespace character as part of
95 # the pattern, escape it with backslash.
97 # Note: do not use \fB#\fIcomment\fR after patterns.
98 # .IP "\fBA\fR (default: off)"
99 # Toggles the PCRE_ANCHORED flag. When this flag is on,
100 # the pattern is forced to be "anchored", that is, it is
101 # constrained to match only at the start of the string which
102 # is being searched (the "subject string"). This effect can
103 # also be achieved by appropriate constructs in the pattern
105 # .IP "\fBE\fR (default: off)"
106 # Toggles the PCRE_DOLLAR_ENDONLY flag. When this flag is on,
107 # a \fB$\fR metacharacter in the pattern matches only at the
108 # end of the subject string. Without this flag, a dollar also
109 # matches immediately before the final character if it is a
110 # newline character (but not before any other newline
111 # characters). This flag is ignored if PCRE_MULTILINE
113 # .IP "\fBU\fR (default: off)"
114 # Toggles the ungreedy matching flag. When this flag is on,
115 # the pattern matching engine inverts the "greediness" of
116 # the quantifiers so that they are not greedy by default,
117 # but become greedy if followed by "?". This flag can also
118 # set by a (?U) modifier within the pattern.
119 # .IP "\fBX\fR (default: off)"
120 # Toggles the PCRE_EXTRA flag.
121 # When this flag is on, any backslash in a pattern that is
122 # followed by a letter that has no special meaning causes an
123 # error, thus reserving these combinations for future expansion.
127 # Patterns are applied in the order as specified in the table, until a
128 # pattern is found that matches the input string.
130 # Each pattern is applied to the entire input string.
131 # Depending on the application, that string is an entire client
132 # hostname, an entire client IP address, or an entire mail address.
133 # Thus, no parent domain or parent network search is done, and
134 # \fIuser@domain\fR mail addresses are not broken up into their
135 # \fIuser\fR and \fIdomain\fR constituent parts, nor is \fIuser+foo\fR
136 # broken up into \fIuser\fR and \fIfoo\fR.
140 # Substitution of substrings from the matched expression into the result
141 # string is possible using the conventional perl syntax ($1, $2, etc.);
142 # specify $$ to produce a $ character as output.
143 # The macros in the result string may need to be written as ${n}
144 # or $(n) if they aren't followed by whitespace.
146 # Note: since negated patterns (those preceded by \fB!\fR) return a
147 # result when the expression does not match, substitutions are not
148 # available for negated patterns.
149 # EXAMPLE SMTPD ACCESS MAP
150 # # Protect your outgoing majordomo exploders
151 # /^(?!owner-)(.*)-outgoing@(.*)/ 550 Use ${1}@${2} instead
153 # # Bounce friend@whatever, except when whatever is our domain (you would
154 # # be better just bouncing all friend@ mail - this is just an example).
155 # /^(friend@(?!my\\.domain$).*)$/ 550 Stick this in your pipe $1
157 # # A multi-line entry. The text is sent as one line.
159 # /^noddy@my\\.domain$/
160 # \ 550 This user is a funny one. You really don't want to send mail to
161 # \ them as it only makes their head spin.
162 # EXAMPLE HEADER FILTER MAP
163 # /^Subject: make money fast/ REJECT
164 # /^To: friend@public\\.com/ REJECT
165 # EXAMPLE BODY FILTER MAP
166 # # First skip over base 64 encoded text to save CPU cycles.
167 # # Requires PCRE version 3.
168 # ~^[[:alnum:]+/]{60,}$~ OK
170 # # Put your own body patterns here.
172 # postmap(1), Postfix lookup table manager
173 # postconf(5), configuration parameters
174 # regexp_table(5), format of POSIX regular expression tables
178 # Use "\fBpostconf readme_directory\fR" or
179 # "\fBpostconf html_directory\fR" to locate this information.
182 # DATABASE_README, Postfix lookup table overview
184 # The PCRE table lookup code was originally written by:
186 # andrewm@connect.com.au
187 # connect.com.au Pty. Ltd.
188 # Level 3, 213 Miller St
189 # North Sydney, NSW, Australia
191 # Adopted and adapted by:
193 # IBM T.J. Watson Research
195 # Yorktown Heights, NY 10598, USA