Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-selector
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-selector
Commits
6c8a3e77
Commit
6c8a3e77
authored
Jul 05, 2018
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the .re_match() method.
parent
4a899580
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
425 additions
and
0 deletions
+425
-0
README.rst
README.rst
+23
-0
re_match.vtc
src/tests/re_match.vtc
+369
-0
vmod_selector.c
src/vmod_selector.c
+21
-0
vmod_selector.vcc
src/vmod_selector.vcc
+12
-0
No files found.
README.rst
View file @
6c8a3e77
...
...
@@ -32,6 +32,7 @@ CONTENTS
* :ref:`func_set.match`
* :ref:`func_set.matched`
* :ref:`func_set.nmatches`
* :ref:`func_set.re_match`
* :ref:`func_set.string`
* :ref:`func_set.which`
* :ref:`func_version`
...
...
@@ -239,6 +240,28 @@ Example::
}
.. _func_set.re_match:
BOOL xset.re_match(STRING subject, INT n, ENUM select)
------------------------------------------------------
::
BOOL xset.re_match(
STRING subject,
INT n=0,
ENUM {UNIQUE, EXACT, FIRST, LAST, SHORTEST, LONGEST} select=UNIQUE
)
Returns ...
Example::
if (myset.hasprefix(req.url)) {
# ...
}
.. _func_set.debug:
STRING xset.debug()
...
...
src/tests/re_match.vtc
0 → 100644
View file @
6c8a3e77
This diff is collapsed.
Click to expand it.
src/vmod_selector.c
View file @
6c8a3e77
...
...
@@ -616,6 +616,27 @@ vmod_set_string(VRT_CTX, struct vmod_selector_set * set, VCL_INT n,
return
(
s
);
}
VCL_BOOL
vmod_set_re_match
(
VRT_CTX
,
struct
vmod_selector_set
*
set
,
VCL_STRING
subject
,
VCL_INT
n
,
VCL_ENUM
selects
)
{
unsigned
idx
;
vre_t
*
re
;
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
set
,
VMOD_SELECTOR_SET_MAGIC
);
idx
=
get_idx
(
ctx
,
n
,
set
,
"re_match"
,
selects
);
if
(
idx
==
UINT_MAX
)
return
(
0
);
if
(
!
check_added
(
ctx
,
set
,
idx
,
REGEX
,
"re_match"
,
"regex"
))
return
(
0
);
re
=
set
->
table
[
idx
]
->
re
;
AN
(
re
);
return
(
VRT_re_match
(
ctx
,
subject
,
re
));
}
VCL_STRING
vmod_set_debug
(
VRT_CTX
,
struct
vmod_selector_set
*
set
)
{
...
...
src/vmod_selector.vcc
View file @
6c8a3e77
...
...
@@ -135,6 +135,18 @@ $Method STRING .string(INT n=0,
Returns ...
Example::
if (myset.hasprefix(req.url)) {
# ...
}
$Method BOOL .re_match(STRING subject, INT n=0,
ENUM {UNIQUE, EXACT, FIRST, LAST, SHORTEST, LONGEST}
select=UNIQUE)
Returns ...
Example::
if (myset.hasprefix(req.url)) {
...
...
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