#include <iostream>
#include <regex>
#include <vector>
int main()
{
std::regex reg("^e.*|^mp.*");
std::vector<std::string> ext{"en0", "en2", "rm", "mp4", "eth0", "null"};
for (int i = 0; i < 6; i++)
{
std::cout << ext[i] << "\t" << std::boolalpha << std::regex_match(ext[i], reg) << std::endl;
}
return 0;
}
正则匹配以字串开头的多项字符串
最新推荐文章于 2023-09-18 11:08:01 发布