RegexPattern
represents a compiled regular expression.
More...
#include <regex.h>
Inheritance diagram for RegexPattern::
Public Methods | |
RegexPattern () | |
default constructor. More... | |
RegexPattern (const RegexPattern &source) | |
Copy Constructor. More... | |
virtual | ~RegexPattern () |
Destructor. More... | |
UBool | operator== (const RegexPattern &that) const |
Comparison operator. More... | |
UBool | operator!= (const RegexPattern &that) const |
Comparison operator. More... | |
RegexPattern & | operator= (const RegexPattern &source) |
Assignment operator. More... | |
virtual RegexPattern * | clone () const |
Create an exact copy of this RegexPattern object. More... | |
virtual uint32_t | flags () const |
Get the match mode flags that were used when compiling this pattern. More... | |
virtual RegexMatcher * | matcher (const UnicodeString &input, UErrorCode &status) const |
virtual UnicodeString | pattern () const |
Returns the regular expression from which this pattern was compiled. More... | |
virtual int32_t | split (const UnicodeString &input, UnicodeString dest[], int32_t destCapacity, UErrorCode &status) const |
Split a string around matches of the pattern. More... | |
void | dump () const |
dump Debug function, displays the compiled form of a pattern. More... | |
virtual UClassID | getDynamicClassID () const |
ICU "poor man's RTTI", returns a UClassID for the actual class. More... | |
Static Public Methods | |
RegexPattern * | compile (const UnicodeString ®ex, UParseError &pe, UErrorCode &status) |
Compiles the regular expression in string form into a RegexPattern object. More... | |
RegexPattern * | compile (const UnicodeString ®ex, uint32_t flags, UParseError &pe, UErrorCode &status) |
Compiles the regular expression in string form into a RegexPattern object using the specified match mode flags. More... | |
UBool | matches (const UnicodeString ®ex, const UnicodeString &input, UParseError &pe, UErrorCode &status) |
Test whether a string matches a regular expression. More... | |
UClassID | getStaticClassID () |
ICU "poor man's RTTI", returns a UClassID for this class. More... | |
Private Methods | |
void | init () |
void | zap () |
void | dumpOp (int32_t index) const |
Private Attributes | |
UnicodeString | fPattern |
uint32_t | fFlags |
UVector * | fCompiledPat |
UnicodeString | fLiteralText |
UVector * | fSets |
UBool | fBadState |
RegexMatcher * | fMatcher |
int32_t | fNumCaptureGroups |
int32_t | fMaxCaptureDigits |
UnicodeSet ** | fStaticSets |
Static Private Attributes | |
const char | fgClassID |
The address of this static class variable serves as this class's ID for ICU "poor man's RTTI". More... | |
Friends | |
class | RegexCompile |
class | RegexMatcher |
RegexPattern
represents a compiled regular expression.
It includes factory methods for creating a RegexPattern object from the source (string) form of a regular expression, methods for creating RegexMatchers that allow the pattern to be applied to input text, and a few convenience methods for simple common uses of regular expressions.
Class RegexPattern is not intended to be subclassed.
Definition at line 88 of file regex.h.
|
default constructor.
Create a RegexPattern object that refers to no actual pattern. Not normally needed; RegexPattern objects are usually created using the factory method
|
|
Copy Constructor. Create a new RegexPattern object that is equivalent to the source object.
|
|
Destructor. Note that a RegexPattern object must persist so long as any RegexMatcher objects that were created from the RegexPattern are active.
|
|
Create an exact copy of this RegexPattern object.
Since RegexPattern is not intended to be subclasses,
|
|
Compiles the regular expression in string form into a RegexPattern object using the specified match mode flags. These compile methods, rather than the constructors, are the usual way that RegexPattern objects are created.
Note that RegexPattern objects must not be deleted while RegexMatcher objects created from the pattern are active. RegexMatchers keep a pointer back to their pattern, so premature deletion of the pattern is a catastrophic error.
|
|
Compiles the regular expression in string form into a RegexPattern object. These compile methods, rather than the constructors, are the usual way that RegexPattern objects are created.
Note that RegexPattern objects must not be deleted while RegexMatcher objects created from the pattern are active. RegexMatchers keep a pointer back to their pattern, so premature deletion of the pattern is a catastrophic error.
All pattern match mode flags are set to their default values.
|
|
dump Debug function, displays the compiled form of a pattern.
|
|
|
|
Get the match mode flags that were used when compiling this pattern.
|
|
ICU "poor man's RTTI", returns a UClassID for the actual class.
Reimplemented from UObject. |
|
ICU "poor man's RTTI", returns a UClassID for this class.
|
|
|
|
|
|
Test whether a string matches a regular expression. This convenience function both compiles the reguluar expression and applies it in a single operation. Note that if the same pattern needs to be applied repeatedly, this method will be less efficient than creating and reusing a RegexPattern object.
|
|
Comparison operator. Two RegexPattern objects are considered equal if they were constructed from identical source patterns using the same match flag settings.
|
|
Assignment operator. After assignment, this RegexPattern will behave identically to the source object.
|
|
Comparison operator. Two RegexPattern objects are considered equal if they were constructed from identical source patterns using the same match flag settings.
|
|
Returns the regular expression from which this pattern was compiled.
|
|
Split a string around matches of the pattern. Somewhat like split() from Perl.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The address of this static class variable serves as this class's ID for ICU "poor man's RTTI".
|