Possible Duplicate:
No matches with c++11 regex
I was reading this book that covers C++11 and I got to the chapter that talks about Regular Expressions. Everything was working fine for me until I got the part about grouping and referring to \1 whenever I needed to refer back to a group. My code compiles perfectly fine :
#include <iostream>
#include <regex>
#include <string>
int main()
{
try
{
regex r1("<(.*)>.*</\\1>");
bool found = regex_match(string("<tag>value</tag>"),r1);
cout << "Does the string match: ";
cout << boolalpha << found << '\n';
}catch( exception e)
{
cout << e.what() << '\n';
}
return 0;
}
What happens however is I get a segmentation fault (core dumped) message. This little snippet was used directly from the book so I highly doubt this is wrong. Note: I do compile using -std=c++0x. Note: I'm using Code::Blocks under Ubuntu 12.04
Any help would be highly appreciated! Thanks!