Hello this is my string:
key{info('1'),details('1'),others('{"1": "2test data1", "2": "2test data2"}')}
i made more than 1 milion of this line and put them in a file like (same)
key{info('1'),details('1'),others('{"1": "2test data1", "2": "2test data2"}')}
key{info('1'),details('1'),others('{"1": "2test data1", "2": "2test data2"}')}
key{info('1'),details('1'),others('{"1": "2test data1", "2": "2test data2"}')}
key{info('1'),details('1'),others('{"1": "2test data1", "2": "2test data2"}')}
key{info('1'),details('1'),others('{"1": "2test data1", "2": "2test data2"}')}
..
..
..
Now, I want to use regex
key[{]info[(][']1['][)],details[(][']1['][)],others[(]['][{](.*?)[}]['][)][}]
(get each line (other) inside)
I test it in PHP with preg_match_all
function and I'm surprised that PHP detects all of the 1 milion line in just 3 seconds but my real program is in C++ so I tried this regex on C++
regex RegexString(R"~(key[{]info[(][']1['][)],details[(][']1['][)],others[(]['][{](.*?)[}]['][)][}])~", regex_constants::optimize);
and I'm surprised but this time was bad. After 10 Min
regex got all lines (detect)
I used the Boost and got better result (2 Min) but what I saw in the PHP (PCRE) (3 sec) made me crazy ... Now, what should I do?
Is there any way in Boost or standard C++ regex to increase speed (done in 3-10 Seconds) or I have to use just PCRE on my C++ project?
Results
Regex : 10 Min
Boost : 2 Min
Pcre(PHP) : 3 Seconds