Re: [ROOT] Is this regexp example possible with ROOT classes?

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Mon Jun 10 2002 - 00:49:59 MEST


Hi Ingo,

  I've added the method TString::Contains(const TRegexp&). For the time
being you can use TString::Index(const TRegexp&)!=kNPOS.

I've forwarded the closing brace issue to Masa.


Cheers, Fons.


On Fri, 2002-06-07 at 14:51, Ingo Strauch wrote:
> Hi ROOTers!
> 
> I have a TString which must not contain several characters:
> 
>   \"';%
> 
> On the commandline I would use egrep like this
> 
>   if ( egrep -q "[\"\\';%]" filetotest.txt ); then
>     echo "Found a forbidden character"
>   else
>     echo "Text is ok"
>   fi
> 
> The following line doesn't work in ROOT (obviously)
> 
>   stringtotest.Contains("[\\\"';%]")
> 
> Could one add a method to TString that works like this?
> And how do I achieve the same thing in the meantime?
> 
> Cheers,
> Ingo
> 
> P.S.: I'm using ROOT 3.02/07 (on linuxsuse6)
> 
> The CINT version that comes with it seems to have a bug, if I type the
> above line, I'm asked to end the line:
> 
> root [11] testit.Contains("[\\\"';%]")
> end with '}'> }
> 
> If I type the closing brace everything works find, but I'd expect to not
> having to use a closing brace...
> 
> -- 
> "What're quantum mechanics?"
> "I don't know. People who repair quantums I suppose."
>                                      --Rincewind, Terry Pratchett "Eric"
-- 
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 : Sat Jan 04 2003 - 23:50:56 MET