c++11新特性正则匹配
下面是示例
#include <iostream> #include <string> #include <fstream> #include <regex> int main() { std::ifstream file("d:/xudp.html"); std::istreambuf_iterator<char> begin(file), end; std::string str(begin, end); std::regex reg("<a [^>]*>"); std::smatch m; for (auto cur = std::sregex_iterator(str.begin(), str.end(), reg);cur != std::sregex_iterator();++cur) { std::cout<<(*cur).str()<<std::endl; } std::cin.get(); return 0; }
【推荐】FlashTable:表单开发界的极速跑车,让你的开发效率一路狂飙
【推荐】Flutter适配HarmonyOS 5知识地图,实战解析+高频避坑指南
【推荐】博客园的心动:当一群程序员决定开源共建一个真诚相亲平台
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 从被喷“假开源”到登顶 GitHub 热榜,这个开源项目上演王者归来!
· Stack Overflow,轰然倒下!
· Cursor 1.2重磅更新,这个痛点终于被解决了!
· 上周热点回顾(6.30-7.6)
· .NET AI 模板