linux and regex?

closed account (Dy7SLyTq)
so im compiling with g++ 4.8.1 using the -std=c++11 flag, and i may have found a bug. using this code:
[code line=35]
while(regex_search(SubCounter, Match, regex("\"[^\"]*\"")))
{Log::Log(__LINE__, __FILE__);
int Line = 0;
TokenList.push_back(Token("STRING", SubCounter.substr(Match.position(0), Match.length(0)), ++Line, Match.position(0)));
SubCounter = SubCounter.substr(Match.length(0), SubCounter.size());

catch(exception &Error)
cout<< Error.what() << endl;
i have verified that it is regex_match because as you can see on line 38 that it calls a function Log. that spits out a message that shows you it hit that line. it never gets called and instead goes to the exception about five times and says regex_error. my question is am i doing something wrong or is it a bug in regex?
Last edited on
AFAIK std::regex is broken in gcc < 4.9. Try boost::regex
closed account (Dy7SLyTq)
damn :L i was hoping to avoid that... oh well. if i do sudo apt-get libboost-dev will that download the whole library with everything compiled that needs to be?
> std::regex is broken in gcc < 4.9

std::regex is broken in mainline GCC SVN
(and it wont be fixed any time soon).
They added it just recently, per

C++11 <regex> support [2013-10-03]
Regular expression support in libstdc++-v3 is now available. to wait another five years for the C++11 Unicode stuff (<regex> was a TR1 component, it was supposed to have been around since 07)
Last edited on
Thanks Cubbi.

Topic archived. No new replies allowed.