Skip to main content

ClikaRT::regex

namespace

Classes

NameDescription
RegexA compiled regular expression. Copyable is NOT provided (a compiled program is heavy); move it. Build one with Regex::compile.

ClikaRT/regex/regex.h

#include <ClikaRT/regex/regex.h>

A compiled regular expression for matching, searching, and rewriting text. Built on a linear-time engine: matching a pattern against a subject can never blow up on adversarial input the way a backtracking engine can, so it is safe to run over untrusted text (a request path, a user-supplied filter). The engine accepts a large PCRE-like syntax subset, but has no backreferences and no lookaround; a pattern needing those must be written a different way.

Compile a pattern once with compile and reuse the Regex for many matches. Compilation of a malformed pattern is the one fallible step (it returns a failure); matching and searching a compiled Regex are infallible and return their answer directly.