Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-re
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
libvmod-re
Commits
9b531d22
Unverified
Commit
9b531d22
authored
Apr 05, 2023
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve match_body documentation
parent
9aa5e6cf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
+16
-10
vmod_re.vcc
src/vmod_re.vcc
+16
-10
No files found.
src/vmod_re.vcc
View file @
9b531d22
#-
# Copyright 2014-20
18
UPLEX Nils Goroll Systemoptimierung
# Copyright 2014-20
23
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
substring
s from the matched substring
.
The VMOD also supports dynamic regex matching with the ``match_dyn``
and ``backref_dyn`` functions::
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment