kaycxx-assert
C++ assertion library
Loading...
Searching...
No Matches
assert_match

Asserts that a string-like value fully matches a regular expression.

The pattern must match the whole value, not just a substring. Pass a string pattern for readable failure output or a precompiled std::regex when the same expression is reused.

#include <regex>
using namespace kaycxx::assert;
int main() {
assert_match("user-42", "user-[0-9]+");
auto id_pattern = std::regex{"item-[0-9]+"};
assert_match("item-7", id_pattern);
}
Includes the complete public assertion API.
Assertion functions and related types.
Definition assert.hpp:15

Null C string pointers never match.