When the `=~` or `!~` operators are used, then parentheses in the regular
expression will sub capture groups, which contain part of the subject string.
-The special expansion `+%{0}+` expands to the portion of the subject that
+The special expansion `%{0}` expands to the portion of the subject that
matched. The expansions +
-`+%{1}+`..`+%{32}+` expand to the contents of any subcapture groups.
+`%{1}`..`%{32}` expand to the contents of any subcapture groups.
When using libpcre[2], named capture groups may also be accessed using the
built-in expansion +
-`+%{regex:<named capture group>}+`.
+`%{regex:<named capture group>}`.
Please see the xref:xlat/predefined.adoc#_0_32[xlat documentation] for
more information on regular expression matching.
Alternation syntax similar to that used in Unix shells may also be
used:
-`+%{%{Foo}:-bar}+`
+`%{%{Foo}:-bar}`
-This code returns the value of `+%{Foo}+`, if it has a value.
+This code returns the value of `%{Foo}`, if it has a value.
Otherwise, it returns a literal string bar.
-`+%{%{Foo}:-%{Bar}}+`
+`%{%{Foo}:-%{Bar}}`
-This code returns the value of `+%{Foo}+`, if it has a value.
-Otherwise, it returns the expansion of `+%{Bar}+`.
+This code returns the value of `%{Foo}`, if it has a value.
+Otherwise, it returns the expansion of `%{Bar}`.
These conditional expansions can be nested to almost any depth, such
-as with `+%{%{One}:-%{%{Two}:-%{Three}}}+`.
+as with `%{%{One}:-%{%{Two}:-%{Three}}}`.
.Examples
-`+%{%{Stripped-User-Name}:-%{User-Name}}+` +
-`+%{%{Framed-IP-Address}:-<none>}+`
+`%{%{Stripped-User-Name}:-%{User-Name}}` +
+`%{%{Framed-IP-Address}:-<none>}`
// Copyright (C) 2019 Network RADIUS SAS. Licenced under CC-by-NC 4.0.
// Development of this documentation was sponsored by Network RADIUS SAS.
Attributes in a list may be referenced via one of the following two
syntaxes:
-`+%{Attribute-Name}+` +
-`+%{<list>:Attribute-Name}+`
+`%{Attribute-Name}` +
+`%{<list>:Attribute-Name}`
The `<list>:` prefix is optional. If given, it must be a valid
reference to an xref:list.adoc[attribute list].
.Examples
-`+%{User-Name}+` +
+`%{User-Name}` +
`+%{request:User-Name} # same as above+` +
-`+%{reply:User-Name}+` +
+`%{reply:User-Name}` +
`+%{outer.request:User-Name} # from inside of a TTLS/PEAP tunnel+`
Examples of using references inside of a string:
than to specific values. For example, a policy can be created that
refers to the User-Name in a request, via:
-`+%{User-Name}+`
+`%{User-Name}`
This string expansion is done only for double-quoted strings and for
the back-tick operator.
.Examples
-`+%{sql:SELECT name FROM mytable WHERE username = %{User-Name}}+`
+`%{sql:SELECT name FROM mytable WHERE username = %{User-Name}}`
// Copyright (C) 2019 Network RADIUS SAS. Licenced under CC-by-NC 4.0.
// Development of this documentation was sponsored by Network RADIUS SAS.
=== +%{0}+..+%{32}+
-`+%{0}+` expands to the portion of the subject that matched the last regular
-expression evaluated. `+%{1}+`..`+%{32}+` expand to the contents of any capture
+`%{0}` expands to the portion of the subject that matched the last regular
+expression evaluated. `%{1}`..`%{32}` expand to the contents of any capture
groups in the pattern.
Every time a regular expression is evaluated, whether it matches or not,
expansions `%{listen:ipaddr}` and `%{listen:ipv6addr}`. If the socket
is listening on a "wildcard" address, then these two expansions will be
different, as follows: the `%{listen:ipaddr}` will be the wildcard
-address and `+%{Packet-DST-IP-Address}+` will be the unicast address to
+address and `%{Packet-DST-IP-Address}` will be the unicast address to
which the packet was sent.
=== +%{Packet-SRC-Port} and %{Packet-DST-Port}+
for some time. If users have paid attention to those warnings, few
modifications will be required.
-Use of attributes in xlats e.g. `+%{User-Name}+` remains unchanged.
+Use of attributes in xlats e.g. `%{User-Name}` remains unchanged.
There is no plan to require prefixes here.
As of v3, the preferred format for `+unknown+` attributes is
Allow `+&Attr-Name[*]+` to mean _sum_. Previously, it just referred to
the first attribute.
-Using `+%{expr:0 + &Attr-Name[*]}+` will cause it to return the sum of
+Using `%{expr:0 + &Attr-Name[*]}` will cause it to return the sum of
the values of all attributes with the given name.
-Note that `+%{expr:1 * &Attr-Name[*]}+` does _not_ mean repeated
+Note that `%{expr:1 * &Attr-Name[*]}` does _not_ mean repeated
multiplication. Instead, the sum of the attributes is taken as before,
and then the result is multiplied by one.