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>
#include <kaycxx/assert.hpp>
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);
}Null C string pointers never match.