147 TTHREAD_TLS_ARRAY(
char,
fgMaxpat,buf);
150 int len = strlen(re);
155 for (
int i = 0; i < len; i++) {
156 if ((
unsigned)slen >
fgMaxpat - 10) {
157 Error(
"MakeWildcard",
"regexp too large");
160 if (i == 0 && re[i] !=
'^') {
167 const char *wc =
"[^/]";
170 const char *wc =
"[^\\/:]";
183 const char *wc =
"[^/]";
186 const char *wc =
"[^\\/:]";
195 if (i == len-1 && re[i] !=
'$') {
212 Error(
"TRegexp::Index",
"Bad Regular Expression");
215 const char*
s =
string.Data();
216 Ssiz_t slen =
string.Length();
217 if (slen < i)
return kNPOS;
220 *len = endp - startp;
253 return r.Index(*
this, &len, start);
263 return r.Index(*
this, extent, start);
312 if (len <= 0 || from > (len - 1) || from < 0)
317 if(rdelim.
Length() == 1) {
318 rdelim =
"[" + rdelim +
"]+";
327 if (pos ==
kNPOS || pos > from) {
329 tok = (*this)(from, last-from+1);
343 from = (from < len) ? from : len;
int Makepat(const char *, Pattern_t *, int)
Make a pattern template from the string pointed to by exp.
const char * Matchs(const char *, size_t len, const Pattern_t *, const char **)
Match a string with a pattern.
void Error(const char *location, const char *msgfmt,...)
Regular expression class.
EStatVal Status()
Check status of regexp.
void CopyPattern(const TRegexp &re)
Copy the regular expression pattern.
static const unsigned fgMaxpat
virtual ~TRegexp()
Destructor.
TRegexp & operator=(const TRegexp &re)
Assignment operator.
const char * MakeWildcard(const char *re)
This routine transforms a wildcarding regular expression into a general regular expression used for p...
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...
TRegexp(const char *re, Bool_t wildcard=kFALSE)
Create a regular expression from the input string.
void GenPattern(const char *re)
Generate the regular expression pattern.
char & operator()(Ssiz_t i)
static const Ssiz_t kNPOS
const char * Data() const
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
A zero length substring is legal.
static constexpr double s