sorry for the late answer. You could do it like this:
root [0] TRegexp r(".dat")
root [1] TString aap("pipo.dat")
root [2] aap.Index(r)
(Ssiz_t)4
root [3] aap.Remove(4)
root [4] aap.Data()
(char* 0x85b7bb4)"pipo"
or without TRegexp:
root [0] TString s("pipo.dat")
root [1] s.Index(".dat")
(Ssiz_t)4
root [2] s.Remove(4)
root [3] s.Data()
(char* 0x85b067c)"pipo"
For the use of TRegexp patterns to detect different file extensions
see $ROOTSYS/icons/root.mimes.
Cheers, Fons.
Sean Kelly wrote:
>
> Hi Rooters,
>
> I would like to remove the suffix .anything from a TString object using
> an appropriately defined TRegexp object. The problem I have is how to
> define the regexp that matches .anything. The only example of Root regexp
> syntax I can find is in tstring.cxx that comes with the standard release.
>
> thanks
>
> Sean Kelly
-- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland Phone: +41 22 7679248 E-Mail: Fons.Rademakers@cern.ch Fax: +41 22 7677910