REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
Loading...
Searching...
No Matches
real.hpp File Reference

The public API: real::regex, real::static_regex and results. More...

#include "real/version.hpp"
#include "real/core/config.hpp"
#include <cassert>
#include <iterator>
#include <optional>
#include <span>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include "real/engine/pike.hpp"
#include "real/core/program.hpp"
#include "real/storage.hpp"
#include "real/unicode/utf8.hpp"
Include dependency graph for real.hpp:

Classes

class  real::basic_match_result< SlotStorage, NameOwner >
 The result of a match attempt: success, spans and captures. More...
 
class  real::basic_match_iterator< Storage, TrailingLA >
 Forward iterator over the non-overlapping matches in a text. More...
 
class  real::basic_match_range< Storage, TrailingLA >
 A range of matches, returned by find_iter() and usable in range-for. More...
 
class  real::basic_regex< Storage >
 A compiled regular expression, parameterized on its storage policy. More...
 
struct  real::basic_regex< Storage >::replacement_piece
 One piece of a parsed replacement template: a slice of the template, or a group to copy. More...
 
struct  real::detail::non_empty_access
 The searches that accept no empty match (std::regex_constants::match_not_null), for the std drop-in; not part of REAL's own interface. More...
 

Namespaces

namespace  real
 REAL's public API: real::regex, real::static_regex, real::flags and the match/iterator types built on them.
 
namespace  real::detail
 DFA construction internals: subset construction over a flattened NFA. Not a stable API.
 

Typedefs

using real::regex = basic_regex< detail::dynamic_storage >
 The runtime-compiled regex type — the primary entry point.
 
using real::match_result = regex::result_type
 The result type of the default, runtime-compiled real::regex.
 
using real::owning_match_result = regex::owning_result_type
 What a single attempt on a TEMPORARY real::regex returns, owning its name context rather than borrowing it (see real::basic_regex::owning_result_type).
 
template<fixed_string Pattern, flags F = flags::none>
using real::static_regex = basic_regex< detail::static_storage< Pattern, F > >
 A fully compile-time regex.
 

Functions

constexpr std::string_view real::detail::c_string_subject (const char *text) noexcept
 A C string as a subject. A null pointer is a caller's bug: a debug build stops on it, and a release build reads it as the empty subject, as the C API does, where constructing a std::string_view from it is undefined.
 
template<typename State , bool Bound, typename Slots >
constexpr bool real::detail::run_attempt (pike_vm< State, Bound > &vm, const program_view &prog, std::string_view subject, std::size_t pos, run_mode mode, Slots &slots, match_semantics sem=match_semantics::first)
 One attempt over a region, as every single search makes it: the trailing-lookaround walk where the pattern has one, else pike_vm::run with its memchr-cascade variant chosen once, here.
 

Detailed Description

The public API: real::regex, real::static_regex and results.

Header-only, C++20, constexpr from end to end. Include this one header.