Re: [ROOT] Use of TRegexp in general.

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Wed Dec 12 2001 - 12:32:11 MET


Hi Georges,

   TRegexp follows the "conventional" regexp syntax and does not
support the advanced perl feautures. Extensions and enhancements
are always welcome.

Cheers, Fons.



Georges Lobo wrote:

> Hi rooters,
> I have a small question about the use of TRegexp. I have only seen examples
> about simple string search requests, but I would like to know if it is
> possible to use the complete possibility of regular expressions, like in
> perl, i.e. to replace directly part of pattern strings and/or to put
> directly in a variable the result of regexp search as it is done in perl by
> the use of parentesis ?
> Maybe an exmaple to clarify I have a line like
> event format= 5 U16 words 1st=TC 2nd=ADC1 3rd=ADC2 4th=ADC3 5th=ADC4
> I want to isolated in this line the 5 and U16
> in perl I would do
> $match=$line[$i]=~/event format=\t([0-9]).*U([0-9]{2}) words.*$/;
> and "5" is found in variable 1
> "U16" in variable 2.
> Is it possible to do it in such a concise way using TRegexp ?
> Thanks in advance.
> 
> -------
> Georges Lobo
> IRMM
> Retieseweg
> 2440 Geel
> BELGIUM
> Tel : +32-14-571-482
> email: lobo@irmm.jrc.be
> 
> 


-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7679480



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:11 MET