#include <string>
#include <iostream>
#include <regex>
using namespace std;

int main() {
	std::regex r("ab(c)");
	std::string s = "abcdefabcghiabc";
	for(std::sregex_iterator i = std::sregex_iterator(s.begin(), s.end(), r);
                             i != std::sregex_iterator();
                             ++i)
    {
        std::smatch m = *i;
        std::cout << "Match value: " << m.str() << " at Position " << m.position() << '\n';
        std::cout << "    Capture: " << m[1].str() << " at Position " << m.position(1) << '\n';
    }
	return 0;
}
