1# Regexp rewrite table23The 'regexp' module implements table lookups by applying a regular expression4to the key value. If it matches - 'replacement' value is returned with $N5placeholders being replaced with corresponding capture groups from the match.6Otherwise, no value is returned.78The regular expression syntax is the subset of PCRE. See9[https://golang.org/pkg/regexp/syntax](https://golang.org/pkg/regexp/syntax)/ for details.1011```12table.regexp <regexp> [replacement] {13 full_match yes14 case_insensitive yes15 expand_placeholders yes16}17```1819Note that [replacement] is optional. If it is not included - table.regexp20will return the original string, therefore acting as a regexp match check.21This can be useful in combination in `destination_in` for22advanced matching:2324```25destination_in regexp ".*-bounce+.*@example.com" {26 ...27}28```2930## Configuration directives3132### full_match _boolean_33Default: `yes`3435Whether to implicitly add start/end anchors to the regular expression.36That is, if `full_match` is `yes`, then the provided regular expression should37match the whole string. With `no` - partial match is enough.3839---4041### case_insensitive _boolean_42Default: `yes`4344Whether to make matching case-insensitive.4546---4748### expand_placeholders _boolean_49Default: `yes`5051Replace '$name' and '${name}' in the replacement string with contents of52corresponding capture groups from the match.5354To insert a literal $ in the output, use $$ in the template.5556## Identity table (table.identity)5758The module 'identity' is a table module that just returns the key looked up.5960```61table.identity { }62```63