Commit c936b7a4 authored by Federico G. Schwindt's avatar Federico G. Schwindt

Allow to use regex matches in expressions

E.g. set req.http.foo = req.http.bar ~ "foobar"

Related to #2075.
parent 16ed1660
......@@ -115,6 +115,11 @@ varnish v1 -vcl {
set req.http.foo = 3.6 * 1.4;
set req.http.foo = 3.6 / 1.4;
set req.http.foo = req.http.foo ~ "bar";
set req.http.foo = req.http.foo !~ "bar";
set req.http.foo = "foo" ~ "bar";
set req.http.foo = "foo" !~ "bar";
set req.ttl = 1s;
}
}
......
......@@ -1136,7 +1136,7 @@ vcc_expr_cmp(struct vcc *tl, struct expr **e, vcc_type_t fmt)
*e = vcc_expr_edit(BOOL, cp->emit, *e, e2);
return;
}
if ((*e)->fmt == STRING &&
if (((*e)->fmt == STRING || (*e)->fmt == STRING_LIST) &&
(tl->t->tok == '~' || tl->t->tok == T_NOMATCH)) {
not = tl->t->tok == '~' ? "" : "!";
vcc_NextToken(tl);
......
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