Dear ROOTers,
I would like to use TPRegexp to parse the content of a string and recognize usefull information inside, but I'm experiencing a strange problem. It looks like that TPRegexp cannot extract more than 10 groups. Is that a "nice" feature of pcre or I'm missing something?
Here an example to show you the problem...
int test() {
TPRegexp
longTest("^\\s*(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s*$");
TString longString("1 2 3 4 5 6 7 8 9 10");
TPRegexp
shortTest("^\\s*(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s*");
TString shortString("1 2 3 4 5 6 7 8 9");
if (shortTest.MatchB(shortString)) {
cout << "Short test passed" << endl;
} else {
cout << "Short test failed" << endl;
}
if (longTest.MatchB(longString)) {
cout << "Long test passed" << endl;
} else {
cout << "Long test failed" << endl;
}
return 0;
}
And this is the output
root [8] .L test.C
root [9] test()
Short test passed
Error in <Match>: pcre_exec error = 0
Long test failed
(int)0
Thanks for your help,
Cheers
Antonio
-- Antonio Bulgheroni, PhDReceived on Thu May 11 2006 - 09:47:50 MEST
This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:58 MET