Everything starting with `$' requires substitution;
the only obvious exception is `$$', which is turned into a single
`$';
the basic substitution is `$<d>', where `<d>' is a digit; 0 means
the whole string, while 1-9 is a submatch, as discussed in
regex(7) and/or re_format
(7).
a `$' followed by a `{' invokes an advanced substitution. The
pattern is:
`$' `{' [ <operator> ] <name> `(' <substitution> `)' `}'
where <name> must be a legal name for the map, i.e.
<name> ::= [a-z][a-z0-9]* (case insensitive)
<operator> ::= `>' `|' `&' `&&' `*' `**' `$'
and <substitution> must be a legal substitution pattern, with no
limits on the nesting level.
The operators are:
>
sub-context invocation; <name> must be a legal, already
defined rewrite context name
|
external command invocation; <name> must refer to a legal,
already defined command name (NOT IMPLEMENTED YET)
&
variable assignment; <name> defines a variable in the
running operation structure which can be dereferenced
later; operator &
assigns a variable in the rewrite
context scope; operator &&
assigns a variable that scopes
the entire session, e.g. its value can be dereferenced
later by other rewrite contexts
*
variable dereferencing; <name> must refer to a variable
that is defined and assigned for the running operation;
operator *
dereferences a variable scoping the rewrite
context; operator **
dereferences a variable scoping the
whole session, e.g. the value is passed across rewrite
contexts
$
parameter dereferencing; <name> must refer to an existing
parameter; the idea is to make some run-time parameters
set by the system available to the rewrite engine, as the
client host name, the bind DN if any, constant parameters
initialized at config time, and so on; no parameter is
currently set by either back-ldap
or back-meta
, but
constant parameters can be defined in the configuration
file by using the rewriteParam
directive.
Substitution escaping has been delegated to the `$' symbol, which
is used instead of `\' in string substitution patterns because
`\' is already escaped by slapd's low level parsing routines; as
a consequence, regex escaping requires two `\' symbols, e.g.
`.*\.foo\.bar
' must be written as `.*\\.foo\\.bar
'.