'C++ Regex "Parenthesis is not closed." Error [duplicate]
In a game I'm making, I'm using a Regex expression to be able to parse in level data from a file. To test this, I'm trying to use the Regex expression (?<=(LEVEL_TYPE:\s))(\w+|[+-]*\d+) to try and get the level type data in the file which is formatted like LEVEL_TYPE: UNDERWATER
This is my code:
std::string RegexPattern("(?<=(LEVEL_TYPE:\\s))(\\w+|[+-]*\\d+)");
std::string target = "LEVEL_TYPE: UNDERWATER";
std::regex reg(RegexPattern);
Without even using the regex_match method, the program throws an error why I try to run the code. When I try to run it, it throws the error:
terminate called after throwing an instance of 'std::regex_error'
what(): Parenthesis is not closed.
I'm trying to compile on MinGW on Windows, GCC version 6.3.0
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
