5 # format of Postfix regular expression tables
7 # \fBpostmap -q "\fIstring\fB" regexp:/etc/postfix/\fIfilename\fR
9 # \fBpostmap -q - regexp:/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 POSIX regular
16 # expression form. In this case, each input is compared against a
17 # list of patterns. When a match is found, the corresponding
18 # 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
24 # as 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 Postfix regular expression table is:
35 # .IP "\fB/\fIpattern\fB/\fIflags result\fR"
36 # When \fIpattern\fR matches the input string,
37 # use the corresponding \fIresult\fR value.
38 # .IP "\fB!/\fIpattern\fB/\fIflags result\fR"
39 # When \fIpattern\fR does \fBnot\fR match the input string,
40 # use 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
45 # matches \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
55 # \fBnot\fR 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 POSIX regular expression enclosed by a pair of
69 # delimiters. The regular expression syntax is documented in
70 # \fBre_format\fR(7) with 4.4BSD, in \fBregex\fR(5) with Solaris, and in
71 # \fBregex\fR(7) with Linux. Other systems may use other document names.
73 # The expression delimiter can be any character, except whitespace
74 # or characters that have special meaning (traditionally the forward
75 # slash is used). The regular expression can contain whitespace.
77 # By default, matching is case-insensitive, and newlines are not
78 # treated as special characters. The behavior is controlled by flags,
79 # which are toggled by appending one or more of the following
80 # characters after the pattern:
81 # .IP "\fBi\fR (default: on)"
82 # Toggles the case sensitivity flag. By default, matching is case
84 # .IP "\fBm\fR (default: off)"
85 # Toggle the multi-line mode flag. When this flag is on, the \fB^\fR
86 # and \fB$\fR metacharacters match immediately after and immediately
87 # before a newline character, respectively, in addition to
88 # matching at the start and end of the input string.
89 # .IP "\fBx\fR (default: on)"
90 # Toggles the extended expression syntax flag. By default, support
91 # for extended expression syntax is enabled.
95 # Patterns are applied in the order as specified in the table, until a
96 # pattern is found that matches the input string.
98 # Each pattern is applied to the entire input string.
99 # Depending on the application, that string is an entire client
100 # hostname, an entire client IP address, or an entire mail address.
101 # Thus, no parent domain or parent network search is done, and
102 # \fIuser@domain\fR mail addresses are not broken up into their
103 # \fIuser\fR and \fIdomain\fR constituent parts, nor is \fIuser+foo\fR
104 # broken up into \fIuser\fR and \fIfoo\fR.
108 # Substitution of substrings from the matched expression into the result
109 # string is possible using $1, $2, etc.;
110 # specify $$ to produce a $ character as output.
111 # The macros in the result string
112 # may need to be written as ${n} or $(n) if they aren't followed
115 # Note: since negated patterns (those preceded by \fB!\fR) return a
116 # result when the expression does not match, substitutions are not
117 # available for negated patterns.
118 # EXAMPLE SMTPD ACCESS MAP
119 # # Disallow sender-specified routing. This is a must if you relay mail
120 # # for other domains.
121 # /[%!@].*[%!@]/ 550 Sender-specified routing rejected
123 # # Postmaster is OK, that way they can talk to us about how to fix
127 # # Protect your outgoing majordomo exploders
129 # /^(.*)-outgoing@(.*)$/ 550 Use ${1}@${2} instead
131 # EXAMPLE HEADER FILTER MAP
132 # # These were once common in junk mail.
133 # /^Subject: make money fast/ REJECT
134 # /^To: friend@public\\.com/ REJECT
135 # EXAMPLE BODY FILTER MAP
136 # # First skip over base 64 encoded text to save CPU cycles.
137 # ~^[[:alnum:]+/]{60,}$~ OK
139 # # Put your own body patterns here.
141 # postmap(1), Postfix lookup table manager
142 # pcre_table(5), format of PCRE tables
143 # cidr_table(5), format of CIDR tables
147 # Use "\fBpostconf readme_directory\fR" or
148 # "\fBpostconf html_directory\fR" to locate this information.
151 # DATABASE_README, Postfix lookup table overview
153 # The regexp table lookup code was originally written by:
157 # That code was based on the PCRE dictionary contributed by:
159 # andrewm@connect.com.au
160 # connect.com.au Pty. Ltd.
161 # Level 3, 213 Miller St
162 # North Sydney, NSW, Australia
164 # Adopted and adapted by:
166 # IBM T.J. Watson Research
168 # Yorktown Heights, NY 10598, USA