boost正则表达式多次匹配
#include "stdafx.h"
#include <cstdlib>
#include <stdlib.h>
#include <boost/regex.hpp>
#include <string>
#include <iostream>
using namespace std;
using namespace boost;
regex reg("a(\\d*)b");
int main(int argc, char* argv[])
{
string in;
cmatch what;
cout << "enter test string" << endl;
getline(cin,in);
sregex_token_iterator it( in.begin(), in.end(), reg, 1 );
sregex_token_iterator end;
while ( it != end )
{
cout << ( *it++ ) << endl;
}
system( "pause" );
return 0;
}

浙公网安备 33010602011771号