Hi Stelios you can do the following: root [10] TRegexp e("_[0-9][0-9]GeV_") root [12] TString str1 = "energy_15GeV_meas" root [13] str1.Contains(e) (const Bool_t)1 root [14] str1.Index(e) (const Ssiz_t)6 root [15] TString res = str1(e) root [16] .p res (class TString)"_15GeV_" In your example I suspect a typo (see below): On Thu, 19 Aug 2004, Stilianos Kesisoglou wrote: > Hi, > > The TString class has a nice feature which is the detection > of a regular expression within a string: > > Bool_t Contains(const TRegexp& pat) const > > Once a regexp has been detected is it possible to store this > expression to a variable? > > For example for the two strings: > > TString str1 = "_15GeV_" > TString str2 = "_30GeV_" > > the following results will be true: > no! > str1.Contains("_[0-9][0-9]_GeV") > str2.Contains("_[0-9][0-9]_GeV") ^ ^ shouldnt that be: str2.Contains("_[0-9][0-9]GeV_") Cheers Otto -- Dr. Otto Schaile Department f"ur Physik, LMU M"unchen Phone: +49 89 289 14070 Am Coulombwall 1, D-85748 Garching, Germany Mobil: +49 160 1553598 FAX: +49 89 289 14072 EMail: Otto.Schaile@Physik.Uni-Muenchen.DE
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:09 MET