TalanSoft Toolkits  201707
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups Pages
List of all members
iPCRE Struct Referenceabstract
Inheritance diagram for iPCRE:
iRegex iUnknown

Detailed Description

PCRE Regular Expression interface.

Compilation

virtual ePCREError Compile (const achar *aaszRegEx, const achar *aaszOpt)=0
 Compile a regular expression. More...
 
virtual ePCREError Compile2 (const achar *aaszRegEx, tPCREOptionsFlags aOpt)=0
 Compile a regular expression. More...
 
virtual tBool GetIsCompiled () const =0
 Get whether the last compile has been successfull. {Property}. More...
 
virtual ePCREError GetLastCompileError () const =0
 Get the last compilation error code. {Property}. More...
 
virtual const acharGetLastCompileErrorDesc () const =0
 Get the last compilation error description. {Property}. More...
 
virtual tU32 GetLastCompileErrorOffset () const =0
 Get the last compilation error offset. {Property}. More...
 
virtual tPCREOptionsFlags GetOptions () const =0
 Get the options used during the last compilation. {Property}. More...
 

Matches

virtual void Reset ()=0
 Resets the regex object. More...
 
virtual tU32 GetNumMarkers () const =0
 Get the number of matches returned by the last Match/Sub call. {Property}. More...
 
virtual sVec2i GetMarker (tU32 anIndex) const =0
 Get the range of the last match. {Property}. More...
 
virtual cString GetString (tU32 anIndex) const =0
 Get the substring in string matched at the specified index. {Property}. More...
 
virtual tU32 GetNumNamed () const =0
 Get the number of named subpatterns. {Property}. More...
 
virtual const acharGetNamedName (tU32 anIndex) const =0
 Get the name of the subpattern at the specified index. {Property}. More...
 
virtual sVec2i GetNamedMarker (const achar *aaszName) const =0
 Get the range of a named match. {Property}. More...
 
virtual cString GetNamedString (const achar *aaszName) const =0
 Get the substring in string matched at the specified index. {Property}. More...
 
virtual tU32 GetNamedIndex (const achar *aaszName) const =0
 Get the index of a named subpattern. More...
 
virtual tI32 MatchRaw (const achar *aaszString)=0
 Match against this regular expression. More...
 
virtual tI32 Match (iHString *ahspString, tU32 anOffset)=0
 Match against this regular expression. More...
 
virtual tI32 Split (const achar *aaszString, tI32 anMaxFields)=0
 Splits based on delimiters matching the regex. More...
 
virtual cString Sub (const achar *aaszString, const achar *aaszReplacement, tBool abDoDollarSub)=0
 Substitues out whatever matches the regex for the second parameter. More...
 

Additional Inherited Members

- Public Member Functions inherited from iRegex
virtual const acharGetImplType () const =0
 Get the implementation type of the regular experssion. {Property}. More...
 
virtual tBool DoesMatch (const achar *aaszText) const =0
 Search for the next match of the expression. More...
 
- Public Member Functions inherited from iUnknown
virtual tBool IsOK () const =0
 Check if the object is valid. More...
 
virtual tI32 AddRef ()=0
 Signal that one more reference of the object has been created. More...
 
virtual tI32 Release ()=0
 Release a reference of the object. More...
 
virtual void DeleteThis ()=0
 Bypass any reference counting and delete this object. More...
 
virtual void Invalidate ()=0
 Invalidate the object. More...
 
virtual iUnknownQueryInterface (const tUUID &aIID)=0
 Query an interface. More...
 
virtual void ListInterfaces (iMutableCollection *apLst, tU32 anFlags) const =0
 Fill a UUID list containing the UUIDs of the implemented interfaces. More...
 
virtual tI32 SetNumRefs (tI32 anNumRefs)=0
 Set the reference counter directly. More...
 
virtual tI32 GetNumRefs () const =0
 Get the number of references to this object. More...
 

Member Function Documentation

virtual ePCREError Compile ( const achar aaszRegEx,
const achar aaszOpt 
)
pure virtual

Compile a regular expression.

Parameters
aaszRegExis the regular expression to compile.
aaszOptis perl style character modifier.
  • g = ePCREOptionsFlags_Global
  • i = ePCREOptionsFlags_Caseless
  • m = ePCREOptionsFlags_Multiline
  • s = ePCREOptionsFlags_DotAll
  • x = ePCREOptionsFlags_Extended
  • U = ePCREOptionsFlags_Ungreedy
virtual ePCREError Compile2 ( const achar aaszRegEx,
tPCREOptionsFlags  aOpt 
)
pure virtual

Compile a regular expression.

Remarks
Uses option flags directly.
virtual tBool GetIsCompiled ( ) const
pure virtual

Get whether the last compile has been successfull. {Property}.

virtual ePCREError GetLastCompileError ( ) const
pure virtual

Get the last compilation error code. {Property}.

virtual const achar* GetLastCompileErrorDesc ( ) const
pure virtual

Get the last compilation error description. {Property}.

virtual tU32 GetLastCompileErrorOffset ( ) const
pure virtual

Get the last compilation error offset. {Property}.

Remarks
The offset is the 'index' of the character in the compiled regex where the error has been detected.
virtual tPCREOptionsFlags GetOptions ( ) const
pure virtual

Get the options used during the last compilation. {Property}.

virtual void Reset ( )
pure virtual

Resets the regex object.

virtual tU32 GetNumMarkers ( ) const
pure virtual

Get the number of matches returned by the last Match/Sub call. {Property}.

virtual sVec2i GetMarker ( tU32  anIndex) const
pure virtual

Get the range of the last match. {Property}.

Remarks
A range is 'x' first character index matched, 'y' last character index matched.
virtual cString GetString ( tU32  anIndex) const
pure virtual

Get the substring in string matched at the specified index. {Property}.

virtual tU32 GetNumNamed ( ) const
pure virtual

Get the number of named subpatterns. {Property}.

virtual const achar* GetNamedName ( tU32  anIndex) const
pure virtual

Get the name of the subpattern at the specified index. {Property}.

virtual sVec2i GetNamedMarker ( const achar aaszName) const
pure virtual

Get the range of a named match. {Property}.

Remarks
A range is 'x' first character index matched, 'y' last character index matched.
Convenience for GetMarker(GetNamedIndex(NAME))
virtual cString GetNamedString ( const achar aaszName) const
pure virtual

Get the substring in string matched at the specified index. {Property}.

Remarks
Convenience for GetString(GetNamedIndex(NAME))
virtual tU32 GetNamedIndex ( const achar aaszName) const
pure virtual

Get the index of a named subpattern.

Returns
eInvalidHandle if the subpattern hasnt been matched.
Remarks
The index points in the markers. {Property}
virtual tI32 MatchRaw ( const achar aaszString)
pure virtual

Match against this regular expression.

Returns
The number of matches found, -1 on error.
virtual tI32 Match ( iHString ahspString,
tU32  anOffset 
)
pure virtual

Match against this regular expression.

Returns
The number of matches found, -1 on error.
virtual tI32 Split ( const achar aaszString,
tI32  anMaxFields 
)
pure virtual

Splits based on delimiters matching the regex.

Parameters
aaszStringis the string to process
anMaxFieldsis the maximum number of fields to split out. Zero (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 lass than N. Anything remaining is in the last field.
virtual cString Sub ( const achar aaszString,
const achar aaszReplacement,
tBool  abDoDollarSub 
)
pure virtual

Substitues out whatever matches the regex for the second parameter.