I'm working on a project that requires me to find all theorems in LaTeX source, but I'm having trouble with std::regex:
#include <iostream>
#include <regex>
int main() {
std::regex r("\\begin{theorem}"); // throws `std::regex_error`
return 0;
}
I've tried constructing this object with different regex_constants, but it always throws exceptions.
Doing a search on SO shows that there were problems with libstdc++, but they were all from several years ago.
I'm using gcc 5.2.0 from homebrew
Why doesn't this work?
e.what()is justregex_error.{is a metacharacter, the regex engine expects a count or a range after it, like{3},{3,}or{3,6}for instance