maddy

Fork https://github.com/foxcpp/maddy

git clone git://git.lin.moe/go/maddy.git

 1# Regexp rewrite table
 2
 3The 'regexp' module implements table lookups by applying a regular expression
 4to the key value. If it matches - 'replacement' value is returned with $N
 5placeholders being replaced with corresponding capture groups from the match.
 6Otherwise, no value is returned.
 7
 8The regular expression syntax is the subset of PCRE. See
 9[https://golang.org/pkg/regexp/syntax](https://golang.org/pkg/regexp/syntax)/ for details.
10
11```
12table.regexp <regexp> [replacement] {
13	full_match yes
14	case_insensitive yes
15	expand_placeholders yes
16}
17```
18
19Note that [replacement] is optional. If it is not included - table.regexp
20will return the original string, therefore acting as a regexp match check.
21This can be useful in combination in `destination_in` for
22advanced matching:
23
24```
25destination_in regexp ".*-bounce+.*@example.com" {
26	...
27}
28```
29
30## Configuration directives
31
32### full_match _boolean_
33Default: `yes`
34
35Whether to implicitly add start/end anchors to the regular expression.
36That is, if `full_match` is `yes`, then the provided regular expression should
37match the whole string. With `no` - partial match is enough.
38
39---
40
41### case_insensitive _boolean_
42Default: `yes`
43
44Whether to make matching case-insensitive.
45
46---
47
48### expand_placeholders _boolean_
49Default: `yes`
50
51Replace '$name' and '${name}' in the replacement string with contents of
52corresponding capture groups from the match.
53
54To insert a literal $ in the output, use $$ in the template.
55
56## Identity table (table.identity)
57
58The module 'identity' is a table module that just returns the key looked up.
59
60```
61table.identity { }
62```
63