[ROOT] Use of TRegexp in general.

From: Georges Lobo (lobo@irmm.jrc.be)
Date: Wed Dec 12 2001 - 10:22:39 MET


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



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