Hi Antonio,
The MatchB function is defined as :
   Bool_t     MatchB(const TString &s, const TString &mods="",
                     Int_t offset=0, Int_t nMaxMatch=30)
So the default number of "matches" is set to 30 which is in your case
too small .
Change your line to
if (longTest.MatchB(longString,"",0,50))
and it will work .
Eddy
> 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, PhD
> 
Received on Thu May 11 2006 - 17:13:01 MEST
This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:58 MET