ROOT logo
ROOT » CORE » BASE » TRegexp

class TRegexp


TRegexp

Regular expression class.

'^'             // start-of-line anchor
'$'             // end-of-line anchor
'.'             // matches any character
'['             // start a character class
']'             // end a character class
'^'             // negates character class if 1st character
'*'             // Kleene closure (matches 0 or more)
'+'             // Positive closure (1 or more)
'?'             // Optional closure (0 or 1)

   Standard classes like [:alnum:], [:alpha:], etc. are not supported,
only [a-zA-Z], [^ntf] and so on.


Function Members (Methods)

public:
TRegexp(const TString& re)
TRegexp(const TRegexp& re)
TRegexp(const char* re, Bool_t wildcard = kFALSE)
virtual~TRegexp()
static TClass*Class()
Ssiz_tIndex(const TString& str, Ssiz_t* len, Ssiz_t start = 0) const
virtual TClass*IsA() const
TRegexp&operator=(const TRegexp& re)
TRegexp&operator=(const TString& re)
TRegexp&operator=(const char* re)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
TRegexp::EStatValStatus()
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
private:
voidCopyPattern(const TRegexp& re)
voidGenPattern(const char* re)
const char*MakeWildcard(const char* re)

Data Members

public:
enum EStatVal { kOK
kIllegal
kNomem
kToolong
};
private:
unsigned short*fPatternCompiled pattern
TRegexp::EStatValfStatStatus
static const unsigned intfgMaxpatMax length of compiled pattern

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TRegexp(const char* re, Bool_t wildcard = kFALSE)
 Create a regular expression from the input string. If wildcard is true
 then the input string contains a wildcard expression (see MakeWildcard()).
TRegexp(const TString& re)
 Create a regular expression from a TString.
TRegexp(const TRegexp& r)
 Copy ctor.
~TRegexp()
 Destructor.
TRegexp& operator=(const TRegexp& r)
 Assignment operator.
TRegexp& operator=(const char *str)
 Assignment operator taking a char* and assigning it to a regexp.
TRegexp& operator=(const TString &str)
 Assignment operator taking a TString.
void GenPattern(const char* re)
 Generate the regular expression pattern.
void CopyPattern(const TRegexp& re)
 Copy the regular expression pattern.
const char * MakeWildcard(const char* re)
 This routine transforms a wildcarding regular expression into
 a general regular expression used for pattern matching.
 When using wildcards the regular expression is assumed to be
 preceded by a "^" (BOL) and terminated by a "$" (EOL). Also, all
 "*"'s and "?"'s (closures) are assumed to be preceded by a "." (i.e. any
 character, except "/"'s) and all .'s are escaped (so *.ps is different
 from *.eps). The special treatment of "/" allows the easy matching of
 pathnames, e.g. "*.root" will match "aap.root", but not "pipo/aap.root".
Ssiz_t Index(const TString& str, Ssiz_t* len, Ssiz_t start = 0) const
 Find the first occurance of the regexp in string and return the position.
 Len is length of the matched string and i is the offset at which the
 matching should start.
EStatVal Status()