I am using C++ regex. was not able to grasp the following programming output.
#include <iostream>
#include <regex>
#include <algorithm>
#include <string>
using namespace std;
int main(){
  regex r("a(b+)(c+)d");    
  string s ="abcd";
  smatch m; 
  cout << s << endl;
  const bool b = regex_match(s,m, r);
  cout << b <<endl; // prints 1 - OK
  if(b){
    cout << m[0] << endl; // prints abcd - OK 
    cout << m[1] << endl; // prints ab - Why? Should it be just b?
    cout<<  m[2] << endl; // prints bc - Why? Should it be just c?
  }
}
I per my exposure to regex in other languages, the parenthesis should match the captured part of the string? so the output should be
1
abcd
b
c
EDIT: I am using g++ 4.6