Tuesday, 17 September 2013

Boost Regex - Stopping after first character

Boost Regex - Stopping after first character

So I'm currently having trouble with my regex where it is stopping after
reading the first character on a regex_search.
The line is in the following format:
transition (0,1)->(1)
transition (0,b)->(300)
etc etc
iss >> w[1];
boost::regex reg("([[:alnum:]])");
boost::smatch x1;
boost::regex_search(w[1], x1, reg);
//string text(x1[0]);
cout << x1[1] << " " << x1[2] << " " << x1[3] << endl;
This prints:
0
0
I want it to print out:
0 1 1
0 b 300
Would appreciate any help. Thanks.

No comments:

Post a Comment