Definition at line 36 of file TPRegexp.h.
Public Member Functions | |
TPRegexp () | |
Default ctor. | |
TPRegexp (const TPRegexp &p) | |
Copy ctor. | |
TPRegexp (const TString &pat) | |
Create and initialize with pat. | |
virtual | ~TPRegexp () |
Cleanup. | |
TString | GetModifiers () const |
Return PCRE modifier options as string. | |
TString | GetPattern () const |
virtual TClass * | IsA () const |
Bool_t | IsValid () const |
Returns true if underlying PCRE structure has been successfully generated via regexp compilation. | |
Int_t | Match (const TString &s, const TString &mods="", Int_t start=0, Int_t nMaxMatch=10, TArrayI *pos=nullptr) |
The number of matches is returned, this equals the full match + sub-pattern matches. | |
Bool_t | MatchB (const TString &s, const TString &mods="", Int_t start=0, Int_t nMaxMatch=10) |
TObjArray * | MatchS (const TString &s, const TString &mods="", Int_t start=0, Int_t nMaxMatch=10) |
Returns a TObjArray of matched substrings as TObjString's. | |
TPRegexp & | operator= (const TPRegexp &p) |
Assignment operator. | |
virtual void | Streamer (TBuffer &) |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
Int_t | Substitute (TString &s, const TString &replace, const TString &mods="", Int_t start=0, Int_t nMatchMax=10) |
Substitute replaces the string s by a new string in which matching patterns are replaced by the replacePattern string. | |
Static Public Member Functions | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
static Bool_t | GetThrowAtCompileError () |
Get value of static flag controlling whether exception should be thrown upon an error during regular expression compilation by the PCRE engine. | |
static void | SetThrowAtCompileError (Bool_t throwp) |
Set static flag controlling whether exception should be thrown upon an error during regular expression compilation by the PCRE engine. | |
Protected Types | |
enum | { kPCRE_GLOBAL = 0x80000000 , kPCRE_OPTIMIZE = 0x40000000 , kPCRE_DEBUG_MSGS = 0x20000000 , kPCRE_INTMASK = 0x0FFF } |
Protected Member Functions | |
void | Compile () |
Compile the fPattern. | |
Int_t | MatchInternal (const TString &s, Int_t start, Int_t nMaxMatch, TArrayI *pos=nullptr) const |
Perform the actual matching - protected method. | |
void | Optimize () |
Send the pattern through the optimizer. | |
UInt_t | ParseMods (const TString &mods) const |
Translate Perl modifier flags into pcre flags. | |
Int_t | ReplaceSubs (const TString &s, TString &final, const TString &replacePattern, Int_t *ovec, Int_t nmatch) const |
Returns the number of expanded '$' constructs. | |
Int_t | SubstituteInternal (TString &s, const TString &replace, Int_t start, Int_t nMaxMatch0, Bool_t doDollarSubst) const |
Perform pattern substitution with optional back-ref replacement. | |
Protected Attributes | |
TString | fPattern |
UInt_t | fPCREOpts |
PCREPriv_t * | fPriv |
Static Protected Attributes | |
static Bool_t | fgThrowAtCompileError = kFALSE |
#include <TPRegexp.h>
|
protected |
Enumerator | |
---|---|
kPCRE_GLOBAL | |
kPCRE_OPTIMIZE | |
kPCRE_DEBUG_MSGS | |
kPCRE_INTMASK |
Definition at line 39 of file TPRegexp.h.
TPRegexp::TPRegexp | ( | ) |
Default ctor.
Definition at line 68 of file TPRegexp.cxx.
TPRegexp::TPRegexp | ( | const TString & | pat | ) |
Create and initialize with pat.
Definition at line 77 of file TPRegexp.cxx.
TPRegexp::TPRegexp | ( | const TPRegexp & | p | ) |
Copy ctor.
Definition at line 87 of file TPRegexp.cxx.
|
virtual |
Cleanup.
Definition at line 97 of file TPRegexp.cxx.
|
static |
|
inlinestaticconstexpr |
Definition at line 93 of file TPRegexp.h.
|
protected |
Compile the fPattern.
Definition at line 226 of file TPRegexp.cxx.
|
inlinestatic |
Definition at line 93 of file TPRegexp.h.
TString TPRegexp::GetModifiers | ( | ) | const |
Return PCRE modifier options as string.
For meaning of mods see ParseMods().
Definition at line 208 of file TPRegexp.cxx.
|
inline |
Definition at line 85 of file TPRegexp.h.
|
static |
Get value of static flag controlling whether exception should be thrown upon an error during regular expression compilation by the PCRE engine.
Definition at line 588 of file TPRegexp.cxx.
|
inlinevirtual |
Reimplemented in TPMERegexp.
Definition at line 93 of file TPRegexp.h.
Bool_t TPRegexp::IsValid | ( | ) | const |
Returns true if underlying PCRE structure has been successfully generated via regexp compilation.
Definition at line 579 of file TPRegexp.cxx.
Int_t TPRegexp::Match | ( | const TString & | s, |
const TString & | mods = "" , |
||
Int_t | start = 0 , |
||
Int_t | nMaxMatch = 10 , |
||
TArrayI * | pos = nullptr |
||
) |
The number of matches is returned, this equals the full match + sub-pattern matches.
nMaxMatch is the maximum allowed number of matches. pos contains the string indices of the matches. Its usage is shown in the routine MatchS. For meaning of mods see ParseMods().
Definition at line 410 of file TPRegexp.cxx.
|
inline |
Definition at line 78 of file TPRegexp.h.
|
protected |
Perform the actual matching - protected method.
Definition at line 356 of file TPRegexp.cxx.
TObjArray * TPRegexp::MatchS | ( | const TString & | s, |
const TString & | mods = "" , |
||
Int_t | start = 0 , |
||
Int_t | nMaxMatch = 10 |
||
) |
Returns a TObjArray of matched substrings as TObjString's.
The TObjArray is owner of the objects and must be deleted by the user. The first entry is the full matched pattern, followed by the sub-patterns. If a pattern was not matched, it will return an empty substring:
produces: "abc" "a" "" "bc"
For meaning of mods see ParseMods().
Definition at line 441 of file TPRegexp.cxx.
Assignment operator.
Definition at line 114 of file TPRegexp.cxx.
|
protected |
Send the pattern through the optimizer.
Definition at line 277 of file TPRegexp.cxx.
Translate Perl modifier flags into pcre flags.
The supported modStr characters are: g, i, m, o, s, x, and the special d for debug. The meaning of the letters is:
Definition at line 163 of file TPRegexp.cxx.
|
protected |
Returns the number of expanded '$' constructs.
Definition at line 300 of file TPRegexp.cxx.
|
static |
Set static flag controlling whether exception should be thrown upon an error during regular expression compilation by the PCRE engine.
Definition at line 597 of file TPRegexp.cxx.
|
virtual |
Reimplemented in TPMERegexp.
|
inline |
Definition at line 93 of file TPRegexp.h.
Int_t TPRegexp::Substitute | ( | TString & | s, |
const TString & | replacePattern, | ||
const TString & | mods = "" , |
||
Int_t | start = 0 , |
||
Int_t | nMaxMatch = 10 |
||
) |
Substitute replaces the string s by a new string in which matching patterns are replaced by the replacePattern string.
The number of substitutions are returned.
produces: 2 "mies noot aap"
For meaning of mods see ParseMods().
Definition at line 561 of file TPRegexp.cxx.
|
protected |
Perform pattern substitution with optional back-ref replacement.
Definition at line 467 of file TPRegexp.cxx.
Definition at line 50 of file TPRegexp.h.
|
protected |
Definition at line 46 of file TPRegexp.h.
|
protected |
Definition at line 48 of file TPRegexp.h.
|
protected |
Definition at line 47 of file TPRegexp.h.