1 vector<CString> vVector; 2 smatch result; 3 string strResult = ""; 4 5 regex pattern("(O\\d{4})((.*\\r\\n)*?)(M99)"); 6 string strMatch = strFile; 7 string::const_iterator iterStart = strMatch.begin(); 8 string::const_iterator iterEnd = strMatch.end(); 9 //搜索G00,并找到程序头中最后一个G00的位置 10 while (regex_search(iterStart, iterEnd, result, pattern)) 11 { 12 strResult = result[0]; 13 iterStart = result[0].second; 14 CString strTemp(strResult.c_str()); 15 vVector.push_back(strTemp); 16 }
原文:https://www.cnblogs.com/wangyueyouyi/p/14610286.html