I am trying to match symbols with following regex: ((?<!-)[<>])
C++ Function:
vector<string> regexSearch(string str, string regEx) {
vector <string> result;
smatch matches;
regex reg(regEx);
// Search string
while (regex_search(str, matches, reg)) {
result.push_back(matches.str(1));
str = matches.suffix().str();
}
return result;
}
Function call:
symbols = regexSearch(input, "((?<!-)[<>])");
Input is a string read from .txt file and looks like this:
4 5
1 > 2
3 > 2
3 < 4
1 < 3
4 > 2
When I run the program it crashes and I get the Invalid special open parenthesis
error.