ROOT 6.16/01 Reference Guide |
Regular expression class.
Note that the '|' operator (union) is not supported, nor are parentheses (grouping). Therefore "a|b" does not match "a".
Standard classes like [:alnum:], [:alpha:], etc. are not supported, only [a-zA-Z], [^ntf] and so on.
Public Types | |
enum | EStatVal { kOK = 0 , kIllegal , kNomem , kToolong } |
Public Member Functions | |
TRegexp (const char *re, Bool_t wildcard=kFALSE) | |
Create a regular expression from the input string. More... | |
TRegexp (const TRegexp &re) | |
Copy ctor. More... | |
TRegexp (const TString &re) | |
Create a regular expression from a TString. More... | |
virtual | ~TRegexp () |
Destructor. More... | |
Ssiz_t | Index (const TString &str, Ssiz_t *len, Ssiz_t start=0) const |
Find the first occurrence of the regexp in string and return the position, or -1 if there is no match. More... | |
TRegexp & | operator= (const char *re) |
Assignment operator taking a char* and assigning it to a regexp. More... | |
TRegexp & | operator= (const TRegexp &re) |
Assignment operator. More... | |
TRegexp & | operator= (const TString &re) |
Assignment operator taking a TString. More... | |
EStatVal | Status () |
Check status of regexp. More... | |
Private Member Functions | |
void | CopyPattern (const TRegexp &re) |
Copy the regular expression pattern. More... | |
void | GenPattern (const char *re) |
Generate the regular expression pattern. More... | |
const char * | MakeWildcard (const char *re) |
This routine transforms a wildcarding regular expression into a general regular expression used for pattern matching. More... | |
Private Attributes | |
Pattern_t * | fPattern |
EStatVal | fStat |
Static Private Attributes | |
static const unsigned | fgMaxpat = 2048 |
#include <TRegexp.h>
enum TRegexp::EStatVal |
Create a regular expression from the input string.
If wildcard is true then the input string will first be interpreted as a wildcard expression by MakeWildcard(), and the result then interpreted as a regular expression.
Definition at line 51 of file TRegexp.cxx.
TRegexp::TRegexp | ( | const TString & | re | ) |
Create a regular expression from a TString.
Definition at line 62 of file TRegexp.cxx.
TRegexp::TRegexp | ( | const TRegexp & | re | ) |
Copy ctor.
Definition at line 70 of file TRegexp.cxx.
|
virtual |
Destructor.
Definition at line 78 of file TRegexp.cxx.
Copy the regular expression pattern.
Definition at line 128 of file TRegexp.cxx.
|
private |
Generate the regular expression pattern.
Definition at line 118 of file TRegexp.cxx.
Find the first occurrence of the regexp in string and return the position, or -1 if there is no match.
Len is length of the matched string and i is the offset at which the matching should start.
Definition at line 209 of file TRegexp.cxx.
|
private |
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".
Definition at line 145 of file TRegexp.cxx.
TRegexp & TRegexp::operator= | ( | const char * | re | ) |
Assignment operator taking a char* and assigning it to a regexp.
Definition at line 98 of file TRegexp.cxx.
Assignment operator.
Definition at line 86 of file TRegexp.cxx.
Assignment operator taking a TString.
Definition at line 108 of file TRegexp.cxx.
TRegexp::EStatVal TRegexp::Status | ( | ) |
Check status of regexp.
Definition at line 231 of file TRegexp.cxx.