TObjArray *GetColumns(const TString &str) { TPRegexp r("\"([\\w\\s,]+)\",?"); TObjArray *colL = new TObjArray(); colL->SetOwner(); Int_t start = 0; while (1) { TString subStr = str(r,start); const TString stripStr = subStr.Strip(TString::kTrailing,','); colL->Add(new TObjString(stripStr)); const Int_t l = subStr.Length(); if (l<=0) break; start += l; } return colL; } void bla() { TObjArray *col1L = GetColumns("\"12\",\"13\",\"14\",\"15\""); for (Int_t i = 0; i < col1L->GetLast()+1; i++) std::cout << ((TObjString *)col1L->At(i))->GetString() << std::endl; TObjArray *col2L = GetColumns("\"My first\",\"My second\",\"My third,fourth\",\"My seventh, eighth\""); for (Int_t i = 0; i < col2L->GetLast()+1; i++) std::cout << ((TObjString *)col2L->At(i))->GetString() << std::endl; }