Мой код:
Код: Выделить всё
bool is_access_log(const char *file_name)
{
std::string name(file_name);
struct stat file_info;
if (stat(file_name, &file_info) < 0 || S_ISDIR((&file_info)->st_mode))
{
// return false if dir
return false;
}
std::regex reg("(.)(-access)(\\d).log");
return std::regex_match(file_name, reg);
}
Подробнее здесь: https://stackoverflow.com/questions/784 ... ex-pattern
Мобильная версия