Improve match_body documentation

parent 9aa5e6cf
#-
# Copyright 2014-2018 UPLEX Nils Goroll Systemoptimierung
# Copyright 2014-2023 UPLEX Nils Goroll Systemoptimierung
# All rights reserved
#
# This document is licensed under the same conditions as the libvmod-re
......@@ -20,9 +20,12 @@ SYNOPSIS
import re;
# object interface
new <obj> = re.regex(STRING, [, INT limit] [, INT limit_recursion])
new <obj> = re.regex(STRING, [, INT limit] [, INT limit_recursion]
[, BOOL forbody])
BOOL <obj>.match(STRING, [, INT limit] [, INT limit_recursion])
STRING <obj>.backref(INT [, STRING fallback])
BOOL <obj>.match_body(req_body | bereq_body | resp_body,
[, INT limit] [, INT limit_recursion])
# function interface
BOOL re.match_dyn(STRING, [, INT limit] [, INT limit_recursion])
......@@ -73,18 +76,21 @@ The equivalent solution with the VMOD looks like this::
}
}
For an example on body matching, see `xregex.match_body()`_.
The object is created at VCL initialization with the regex containing
the capture expression, only describing the substring to be
matched. When a match with the ``match`` method succeeds, then a
captured string can be obtained from the ``backref`` method.
matched. When a match with the ``match`` or ``match_body`` method
succeeds, then a captured string can be obtained from the ``backref``
method.
Calls to the ``backref`` method refer back to the most recent
successful call to ``match`` for the same object in the same task
scope; that is, in the same client or backend context. For example if
``match`` is called for an object in one of the ``vcl_backend_*``
subroutines and returns ``true``, then subsequent calls to ``backref``
in the same backend scope extract substrings from the matched
substring.
successful call to ``match`` or ``match_body`` for the same object in
the same task scope; that is, in the same client or backend
context. For example if ``match`` is called for an object in one of
the ``vcl_backend_*`` subroutines and returns ``true``, then
subsequent calls to ``backref`` in the same backend scope extract
substrings from the matched substring.
The VMOD also supports dynamic regex matching with the ``match_dyn``
and ``backref_dyn`` functions::
......
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