Skip to content

Latest commit

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

constexpr_regex

Constexpr regex parser. Constructs a non-deterministic finite automaton at compile-time from a string literal containing a regex expression. See the example project for some examples.

#include"constexpr_regex.hpp"intmain() {
using email_regex = kaixo::regex<"\\b(?'username'[a-zA-Z0-9._%+-]+)@(?'domain'[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}\\b)">;
constexprauto parsed = email_regex::parse("my email address is test@example.com");
constexprauto username = parsed.groups["username"].match;
constexprauto domain = parsed.groups["domain"].match;
static_assert(parsed == "test@example.com");
static_assert(username == "test");
static_assert(domain == "example.com");
return0;
}

About

Compile-time regex parser.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages