ROOT
6.07/01
Reference Guide
|
Definition at line 42 of file TPRegexp.h.
Public Member Functions | |
TPRegexp () | |
TPRegexp (const TString &pat) | |
Create and initialize with pat. More... | |
TPRegexp (const TPRegexp &p) | |
Copy ctor. More... | |
virtual | ~TPRegexp () |
Cleanup. More... | |
Bool_t | IsValid () const |
Returns true if underlying PCRE structure has been successfully generated via regexp compilation. More... | |
Int_t | Match (const TString &s, const TString &mods="", Int_t start=0, Int_t nMaxMatch=10, TArrayI *pos=0) |
The number of matches is returned, this equals the full match + sub-pattern matches. More... | |
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. More... | |
Bool_t | MatchB (const TString &s, const TString &mods="", Int_t start=0, Int_t nMaxMatch=10) |
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. More... | |
TString | GetPattern () const |
TString | GetModifiers () const |
Return PCRE modifier options as string. More... | |
TPRegexp & | operator= (const TPRegexp &p) |
Assignment operator. More... | |
Static Public Member Functions | |
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. More... | |
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. More... | |
Protected Types | |
enum | { kPCRE_GLOBAL = 0x80000000, kPCRE_OPTIMIZE = 0x40000000, kPCRE_DEBUG_MSGS = 0x20000000, kPCRE_INTMASK = 0x0FFF } |
Protected Member Functions | |
void | Compile () |
Compile the fPattern. More... | |
void | Optimize () |
Send the pattern through the optimizer. More... | |
UInt_t | ParseMods (const TString &mods) const |
Translate Perl modifier flags into pcre flags. More... | |
Int_t | ReplaceSubs (const TString &s, TString &final, const TString &replacePattern, Int_t *ovec, Int_t nmatch) const |
Returns the number of expanded '$' constructs. More... | |
Int_t | MatchInternal (const TString &s, Int_t start, Int_t nMaxMatch, TArrayI *pos=0) const |
Perform the actual matching - protected method. More... | |
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. More... | |
Protected Attributes | |
TString | fPattern |
PCREPriv_t * | fPriv |
UInt_t | fPCREOpts |
Static Protected Attributes | |
static Bool_t | fgThrowAtCompileError |
#include <TPRegexp.h>
|
protected |
Enumerator | |
---|---|
kPCRE_GLOBAL | |
kPCRE_OPTIMIZE | |
kPCRE_DEBUG_MSGS | |
kPCRE_INTMASK |
Definition at line 45 of file TPRegexp.h.
TPRegexp::TPRegexp | ( | ) |
TPRegexp::TPRegexp | ( | const TString & | pat | ) |
Create and initialize with pat.
Definition at line 56 of file TPRegexp.cxx.
TPRegexp::TPRegexp | ( | const TPRegexp & | p | ) |
Copy ctor.
Definition at line 66 of file TPRegexp.cxx.
|
virtual |
Cleanup.
Definition at line 76 of file TPRegexp.cxx.
|
protected |
Compile the fPattern.
Definition at line 194 of file TPRegexp.cxx.
Referenced by Match(), TPMERegexp::Reset(), Substitute(), and TPMERegexp::TPMERegexp().
TString TPRegexp::GetModifiers | ( | ) | const |
Return PCRE modifier options as string.
For meaning of mods see ParseMods().
Definition at line 176 of file TPRegexp.cxx.
Referenced by TPMERegexp::Print().
|
inline |
Definition at line 91 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 495 of file TPRegexp.cxx.
Bool_t TPRegexp::IsValid | ( | ) | const |
Returns true if underlying PCRE structure has been successfully generated via regexp compilation.
Definition at line 486 of file TPRegexp.cxx.
Int_t TPRegexp::Match | ( | const TString & | s, |
const TString & | mods = "" , |
||
Int_t | start = 0 , |
||
Int_t | nMaxMatch = 10 , |
||
TArrayI * | pos = 0 |
||
) |
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 335 of file TPRegexp.cxx.
Referenced by TString::Index(), TUri::IsPathRootless(), TUri::IsQuery(), TUri::IsScheme(), MatchB(), MatchS(), TStringToken::NextToken(), and TDataSetManager::ParseUri().
|
inline |
Definition at line 84 of file TPRegexp.h.
Referenced by TEveElement::FindChild(), TEveElement::FindChildren(), TCollection::Print(), and regexp().
|
protected |
Perform the actual matching - protected method.
Definition at line 303 of file TPRegexp.cxx.
Referenced by Match(), and TPMERegexp::Match().
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 366 of file TPRegexp.cxx.
Referenced by TDocLatexDirective::CreateLatex(), TUri::IsAuthority(), regexp(), TUri::RemoveDotSegments(), TUri::SetAuthority(), TUri::SetHierPart(), TUri::SetRelativePart(), and TUri::SetUri().
Assignment operator.
Definition at line 88 of file TPRegexp.cxx.
|
protected |
Send the pattern through the optimizer.
Definition at line 226 of file TPRegexp.cxx.
Referenced by Compile().
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 131 of file TPRegexp.cxx.
Referenced by Match(), TPMERegexp::Reset(), Substitute(), and TPMERegexp::TPMERegexp().
|
protected |
Returns the number of expanded '$' constructs.
Definition at line 247 of file TPRegexp.cxx.
Referenced by SubstituteInternal().
Set static flag controlling whether exception should be thrown upon an error during regular expression compilation by the PCRE engine.
Definition at line 504 of file TPRegexp.cxx.
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 468 of file TPRegexp.cxx.
Referenced by THtml::TFileDefinition::NormalizePath(), regexp(), and TUri::RemoveDotSegments().
|
protected |
Perform pattern substitution with optional back-ref replacement.
Definition at line 392 of file TPRegexp.cxx.
Referenced by Substitute(), and TPMERegexp::Substitute().
|
staticprotected |
Definition at line 56 of file TPRegexp.h.
Referenced by Compile(), GetThrowAtCompileError(), and SetThrowAtCompileError().
|
protected |
Definition at line 52 of file TPRegexp.h.
Referenced by Compile(), GetPattern(), operator=(), Optimize(), TPMERegexp::Print(), TPMERegexp::Reset(), and TPRegexp().
|
protected |
Definition at line 54 of file TPRegexp.h.
Referenced by Compile(), GetModifiers(), Match(), TPMERegexp::Match(), operator=(), Optimize(), ParseMods(), ReplaceSubs(), TPMERegexp::Reset(), Substitute(), SubstituteInternal(), TPMERegexp::TPMERegexp(), and TPRegexp().
|
protected |
Definition at line 53 of file TPRegexp.h.
Referenced by Compile(), IsValid(), Match(), MatchInternal(), operator=(), Optimize(), Substitute(), SubstituteInternal(), TPRegexp(), and ~TPRegexp().