Character classes are supported like this: TRegexp re("[0-9]+") But you are right that we should add more clear doc. For the time being have a look at: http://root.cern.ch/lxr/source/base/src/Match.cxx -- Fons On Thu, 2002-08-08 at 00:36, Christian Holm Christensen wrote: > Hi David, > > On Wed, 07 Aug 2002 14:50:30 CDT > David Faden <dfaden@iastate.edu> wrote > concerning "[ROOT] What features does TRegexp support?": > > Hi, > > What regular expression features does TRegexp have? The following > > expression (taken from the perldata man page) doesn't seem to work: > > > > ^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$ > > First off, you did remember to escape the backslashes, didn't you? > > Second off, it has previously been mentioned [1] that TRegexp does not > support all Perl extensions to the `normal' (Posix?) regular > expressions - I think Emacs Regular Expressions is a better reference > (start emacs, type "C-h i m emacs C-j m Regexps C-j"). > > Thirdly, I'm not sure about the underlined: > > ^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$ > ^^^ > > What do you mean? Is it an optional '(' - in that case I think it > needs to be escaped, otherwise you have a syntax error. Is it a Perl > operator? - in that case, I don't think it's valid. > > However, I do agree that some doc on the avaliable operators, ladida, > would be nice. For example, is character classes supported: > > root [0] TString n("1234") > root [1] TRegexp re("[[:digit:]]+") > root [2] int l > root [3] re.Index(n, &l) > (const Ssiz_t)(-1) > > Doesn't seem like it. > > There's a Perl compatible library called pcre (Perl Compatible Regular > Expressions), avaliable for many platforms at [2]. If you're on a > GNU/Linux box, chances are that you have it already. A C++ wrapper > exists at [3] too. See also [4] > > Yours, > > ____ | Christian Holm Christensen > |_| | ------------------------------------------------------------- > | | Address: Sankt Hansgade 23, 1. th. Phone: (+45) 35 35 96 91 > _| DK-2200 Copenhagen N Cell: (+45) 24 61 85 91 > _| Denmark Office: (+45) 353 25 305 > ____| Email: cholm@nbi.dk Web: www.nbi.dk/~cholm > | | > > > > [1] http://root.cern.ch/root/roottalk/roottalk01/4536.html > [2] http://www.pcre.org/ > [3] ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/Contrib/ > [4] http://www.daemon.de/pcre++/ -- 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:51:03 MET