regular expressions
Aug 21, 2012 at 7:13pm UTC
So I just started playing around with regular expressions, and I quickly ran into some trouble. Here's my code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include <tr1/regex>
#include <iostream>
#include <string>
int main()
{
std::string str = "Hello world" ;
std::tr1::regex rx("ello" );
if (regex_match(str.begin(), str.end(), rx))
{
std::cout << "WORKS" ;
}
return 0;
}
I get an error on line 8 that says 8 " `std::tr1' has not been declared " and 8 "`regex' undeclared (first use this function)." Could it be that my compiler does not support TR1?
Aug 21, 2012 at 7:41pm UTC
Try hesder<regex>
Aug 21, 2012 at 10:11pm UTC
i included hesder<regex> in the header and i got the same errors along with " #include expects "FILENAME" or <FILENAME> " for the first line.
Topic archived. No new replies allowed.