I have this code:
try
{
std::string input = "00179d006d000174";
std::regex pattern("[[:xdigit:]]{16}");
if(std::regex_match(input, pattern))
std::cout << "Full match" << std::endl;
}
catch(const std::exception& e)
{
std::cerr << e.what() << std::endl;
}
But can't understand two things:
- why does it throw a regex_error
- if I add the std::regex::basic flag to the the regex it no longer throws the error but still doesn't print "full match"
- how would I match a simple sequence of 16 hex digits like the one in the example?