Varnish module (VMOD) to access the Google RE2 regular expression engine
Find a file
2025-09-16 17:03:14 +02:00
pkg/rpm Fix previous: if COPYING is removed, it should be from the Makefile and rpm 2022-12-08 14:03:13 +01:00
src bugfix: Prevent operations on failed compilation 2025-09-02 16:44:17 +02:00
.clang-tidy CI: Introduce clang-tidy 2025-09-02 16:44:17 +02:00
.dir-locals.el initial commit, passes a simple test for an initial verson of .match() 2016-03-13 13:01:41 +01:00
.gitignore Handle src/vmod_vcs_version.txt 2025-05-12 11:28:43 +02:00
.gitlab-ci.yml ci: Fail pipeline on clang-tidy warnings 2025-09-16 17:03:14 +02:00
bootstrap Migrate to VCDK 2025-05-12 11:28:43 +02:00
CHANGES.md Add a change log. 2021-04-22 13:37:18 +02:00
configure.ac build: Don't use vmod_vcs_version if no git repo 2025-09-16 17:03:14 +02:00
CONTRIBUTING.rst Fix build by upgrading build to C++17 2025-05-12 11:27:57 +02:00
INSTALL.rst Update installation instructions for RPMs. 2019-04-16 15:32:19 +02:00
LICENSE Standardize LICENSE 2022-12-01 16:24:17 +01:00
Makefile.am CI: Add coverage target to Makefile 2025-09-02 16:44:17 +02:00
README.md README refacto 2025-05-23 15:59:55 +02:00

vmod_re2

Varnish Module for access to the Google RE2 regular expression engine

DESCRIPTION

Varnish Module (VMOD) for access to the Google RE2 regular expression engine.

Varnish VCL uses the PCRE library (Perl Compatible Regular Expressions) for its native regular expressions, which runs very efficiently for many common uses of pattern matching in VCL, as attested by years of successful use of PCRE with Varnish.

But for certain kinds of patterns, the worst-case running time of the PCRE matcher is exponential in the length of the string to be matched. The matcher uses backtracking, implemented with recursive calls to the internal match() function. In principle there is no upper bound to the possible depth of backtracking and recursion, except as imposed by the varnishd runtime parameters pcre_match_limit and pcre_match_limit_recursion; matches fail if either of these limits are met. Stack overflow caused by deep backtracking has occasionally been the subject of varnishd issues.

RE2 differs from PCRE in that it limits the syntax of patterns so that they always specify a regular language in the formally strict sense. Most notably, backreferences within a pattern are not permitted, for example (foo|bar)\1 to match foofoo and barbar, but not foobar or barfoo. See the link in SEE ALSO for the specification of RE2 syntax.

This means that an RE2 matcher runs as a finite automaton, which guarantees linear running time in the length of the matched string. There is no backtracking, and hence no risk of deep recursion or stack overflow.

The relative advantages and disadvantages of RE2 and PCRE is a broad subject, beyond the scope of this manual. See the references in SEE ALSO for more in-depth discussion.

INSTALLATION

See INSTALL.rst in the source repository.

AUTHOR

UPLEX Nils Goroll Systemoptimierung

SEE ALSO

Copyright (c) 2016-2018 UPLEX Nils Goroll Systemoptimierung
All rights reserved

Author: Geoffrey Simmons <geoffrey.simmons@uplex.de>

See LICENSE