about boost regex iterator

Hi, I have a html tag:
string html = "<a target=\"_blank\" href=\"http://www.google.com\">";
and I need to get the http://www.google.com
I know there is a smatch I can use, but how can I do this with an iterator?
I've tried this, not work..
thanks in advance.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <boost/regex.hpp>
#include <string>
#include <vector>
#include <iostream>
using namespace std;
using namespace boost;

int main() {
	string html = "<a target=\"_blank\" href=\"http://www.google.com\">";
	string pattern = "target=\"_blank\" href=\"([^\"]+)\"";
    matches m;
    regex reg(pattern);    
    sregex_iterator itrBegin(html.begin(), html.end(), reg);
    sregex_iterator itrEnd;
    for(sregex_iterator itr=itrBegin; itr!=itrEnd; ++itr) {
    	cout << itr->str() << endl;
    }
    return 0;
}
Topic archived. No new replies allowed.