When I run the program I get a regex_error message stating that I have an invalid
special open parenthesis. I know about escape characters and have tried one back slash
and two back slashes. Neither one solved the problem. The program errors out when I get to the second regex expression. regexa = "(?<=\[)[\.0-9-]+";
I have tried this on Visual Studio Code and on an online compiler.
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <regex>
using namespace std;
int main() {
string line = "SG_ S1_PID_00_PIDsSupported_01_20 m0 : 31|32@0+ (1,0) [0|4294967295] Vector__XXX";
smatch m; // flag type for determining the matching behavior
regex regexa("[\\.0-9-]+(?=\\])");
regex_search(line, m, regexa); // searches pattern regexp in the string "line"
string max = m.str(0);
cout << "max is: " << m.str(0) << endl;
regexa = "(?<=\\[)[\\.0-9-]+";
regex_search(line, m, regexa); // searches pattern regexp in the string "line"
string min = m.str(0);
cout << "min is: " << m.str(0) << endl;
regexa = "(?<=\\()[\\.0-9-]+";
regex_search(line, m, regexa); // searches pattern regexp in the string "line"
string scale = m.str(0);
cout << "scale is: " << m.str(0) << endl;
}