Commit b0e9f92f authored by Geoff Simmons's avatar Geoff Simmons

Minor doc polish.

parent 0b40f914
...@@ -604,16 +604,21 @@ prior match was case insensitive, and the matched string differs in ...@@ -604,16 +604,21 @@ prior match was case insensitive, and the matched string differs in
case, the string with the case as added to the set is returned. case, the string with the case as added to the set is returned.
``.element()`` fails and returns NULL if the rules for ``n`` and ``.element()`` fails and returns NULL if the rules for ``n`` and
``select`` indicate failure; that is, if ``n`` is out of range ``select`` indicate failure; that is:
(greater than the number of elements in the set), or if ``n`` < 1 and
``select`` fails for ``UNIQUE`` or ``EXACT``, or ``n`` < 1 and there * ``n`` is out of range (greater than the number of elements in the
was no prior invocation of ``.match()`` or ``.hasprefix()``. set)
* ``n`` < 1 and ``select`` fails for ``UNIQUE`` or ``EXACT``
* ``n`` < 1 and there was no prior invocation of ``.match()`` or
``.hasprefix()``.
Example:: Example::
if (myset.hasprefix(req.url)) { if (myset.hasprefix(req.url)) {
# Construct a redirect response for another host, using the # Construct a redirect response for another host, using the
# matching prefix in the request URL as the new URL. # matching prefix in the request URL as the new URL path.
set resp.http.Location = "http://other.com" + myset.element(); set resp.http.Location = "http://other.com" + myset.element();
} }
......
...@@ -520,16 +520,21 @@ prior match was case insensitive, and the matched string differs in ...@@ -520,16 +520,21 @@ prior match was case insensitive, and the matched string differs in
case, the string with the case as added to the set is returned. case, the string with the case as added to the set is returned.
``.element()`` fails and returns NULL if the rules for ``n`` and ``.element()`` fails and returns NULL if the rules for ``n`` and
``select`` indicate failure; that is, if ``n`` is out of range ``select`` indicate failure; that is:
(greater than the number of elements in the set), or if ``n`` < 1 and
``select`` fails for ``UNIQUE`` or ``EXACT``, or ``n`` < 1 and there * ``n`` is out of range (greater than the number of elements in the
was no prior invocation of ``.match()`` or ``.hasprefix()``. set)
* ``n`` < 1 and ``select`` fails for ``UNIQUE`` or ``EXACT``
* ``n`` < 1 and there was no prior invocation of ``.match()`` or
``.hasprefix()``.
Example:: Example::
if (myset.hasprefix(req.url)) { if (myset.hasprefix(req.url)) {
# Construct a redirect response for another host, using the # Construct a redirect response for another host, using the
# matching prefix in the request URL as the new URL. # matching prefix in the request URL as the new URL path.
set resp.http.Location = "http://other.com" + myset.element(); set resp.http.Location = "http://other.com" + myset.element();
} }
...@@ -629,8 +634,8 @@ If ``all`` is ``false``, then return the result of replacing the first ...@@ -629,8 +634,8 @@ If ``all`` is ``false``, then return the result of replacing the first
portion of ``str`` that matches the regex with ``sub``. ``sub`` may portion of ``str`` that matches the regex with ``sub``. ``sub`` may
contain backreferences ``\0`` through ``\9``, to include captured contain backreferences ``\0`` through ``\9``, to include captured
substrings from ``str`` in the substitution. This is the same substrings from ``str`` in the substitution. This is the same
operation performed by the native VCL function ``regsub(str, regex, operation performed by the native VCL function
sub)`` (see vcl(7)). By default, ``all`` is false. ``regsub(str, regex, sub)`` (see vcl(7)). By default, ``all`` is false.
If ``all`` is ``true``, return the result of replacing each If ``all`` is ``true``, return the result of replacing each
non-overlapping portion of ``str`` that matches the regex with ``sub`` non-overlapping portion of ``str`` that matches the regex with ``sub``
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment