Wrapper for PCRE library (Perl Compatible Regular Expressions).
Based on PME - PCRE Made Easy by Zachary Hansen.
Supports main Perl operations using regular expressions (Match, Substitute and Split). To retrieve the results one can simply use operator[] returning a TString.
See $ROOTSYS/tutorials/regexp_pme.C for examples.
Definition at line 97 of file TPRegexp.h.
Copy global-match state from 're; so that this regexp can continue parsing the string from where 're' left off.
Alternatively, GetGlobalPosition() get be used to retrieve the last match position so that it can passed to Match().
Ideally, as it is done in PERL, the last match position would be stored in the TString itself.
Definition at line 684 of file TPRegexp.cxx.
Splits into at most maxfields.
If maxfields is unspecified or 0, trailing empty matches are discarded. If maxfields is positive, no more than maxfields fields will be returned and trailing empty matches are preserved. If maxfields is empty, all fields (including trailing empty ones) are returned. This should be the same as the perl behaviour.
If pattern produces sub-matches, these are also stored in the result.
A pattern matching the null string will split the value of EXPR into separate characters at each point it matches that way.
- Parameters
-
[in] | s | string to split |
[in] | maxfields | maximum number of fields to be split out. 0 means split all fields, but discard any trailing empty bits. Negative means split all fields and keep trailing empty bits. Positive means keep up to N fields including any empty fields less than N. Anything remaining is in the last field. |
- Returns
- number of fields found
Definition at line 765 of file TPRegexp.cxx.
Substitute matching part of s with r, dollar back-ref substitution is performed if doDollarSubst is true (default).
Returns the number of substitutions made.
After the substitution, another pass is made over the resulting string and the following special tokens are interpreted:
\l
lowercase next char,
\u
uppercase next char,
\L
lowercase till \E
,
\U
uppercase till \E
, and
\E
end case modification.
Definition at line 874 of file TPRegexp.cxx.