#include <iostream>
#include <dirent.h>
#include <regex>
#include <vector>
#include <string>
using namespace std;
int main(void){
vector<string> dir{".","..",".test","test.txt", "text" };
string rgs="^\\.";
cout <<rgs<<endl;
regex self_regex(rgs);
for (auto &x:dir) {
if (regex_search(x,self_regex)){
cout << "matches regex" << x << endl;
}
else{
cout << "does not match regex " << x << endl;
}
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8ZGlyZW50Lmg+CiNpbmNsdWRlIDxyZWdleD4KI2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPHN0cmluZz4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbih2b2lkKXsKCXZlY3RvcjxzdHJpbmc+IGRpcnsiLiIsIi4uIiwiLnRlc3QiLCJ0ZXN0LnR4dCIsICJ0ZXh0IiB9OwoKICAgIHN0cmluZyByZ3M9Il5cXC4iOwogICAgY291dCA8PHJnczw8ZW5kbDsgCiAgICByZWdleCBzZWxmX3JlZ2V4KHJncyk7CiAgICBmb3IgKGF1dG8gJng6ZGlyKSB7CiAgICAgICAgaWYgKHJlZ2V4X3NlYXJjaCh4LHNlbGZfcmVnZXgpKXsKICAgICAgICAgICAgY291dCA8PCAibWF0Y2hlcyByZWdleCIgPDwgeCA8PCBlbmRsOwogICAgICAgIH0KICAgICAgICBlbHNlewogICAgICAgICAgICAgICAgY291dCA8PCAiZG9lcyBub3QgbWF0Y2ggcmVnZXggIiA8PCB4IDw8IGVuZGw7CiAgICAgICAgfQogICAgfQogICAgcmV0dXJuIDA7Cn0=