RegexPattern
represents a compiled regular expression.
More...
#include <regex.h>
Inheritance diagram for RegexPattern:
Public Member Functions | |
RegexPattern () | |
default constructor. | |
RegexPattern (const RegexPattern &source) | |
Copy Constructor. | |
virtual | ~RegexPattern () |
Destructor. | |
UBool | operator== (const RegexPattern &that) const |
Comparison operator. | |
UBool | operator!= (const RegexPattern &that) const |
Comparison operator. | |
RegexPattern & | operator= (const RegexPattern &source) |
Assignment operator. | |
virtual RegexPattern * | clone () const |
Create an exact copy of this RegexPattern object. | |
virtual uint32_t | flags () const |
Get the match mode flags that were used when compiling this pattern. | |
virtual RegexMatcher * | matcher (const UnicodeString &input, UErrorCode &status) const |
Creates a RegexMatcher that will match the given input against this pattern. | |
virtual RegexMatcher * | matcher (UErrorCode &status) const |
Creates a RegexMatcher that will match against this pattern. | |
virtual UnicodeString | pattern () const |
Returns the regular expression from which this pattern was compiled. | |
virtual int32_t | split (const UnicodeString &input, UnicodeString dest[], int32_t destCapacity, UErrorCode &status) const |
Split a string into fields. | |
virtual UClassID | getDynamicClassID () const |
ICU "poor man's RTTI", returns a UClassID for the actual class. | |
Static Public Member Functions | |
RegexPattern * | compile (const UnicodeString ®ex, UParseError &pe, UErrorCode &status) |
Compiles the regular expression in string form into a RegexPattern object. | |
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. | |
RegexPattern * | compile (const UnicodeString ®ex, uint32_t flags, UErrorCode &status) |
Compiles the regular expression in string form into a RegexPattern object using the specified match mode flags. | |
UBool | matches (const UnicodeString ®ex, const UnicodeString &input, UParseError &pe, UErrorCode &status) |
Test whether a string matches a regular expression. | |
UClassID | getStaticClassID () |
ICU "poor man's RTTI", returns a UClassID for this class. | |
Friends | |
class | RegexCompile |
class | RegexMatcher |
class | RegexCImpl |
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 99 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. Note that it is often more convenient to construct a RegexMatcher directly from a pattern string instead of than separately compiling the pattern and then creating a RegexMatcher object from the pattern.
|
|
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. Note that it is often more convenient to construct a RegexMatcher directly from a pattern string instead of than separately compiling the pattern and then creating a RegexMatcher object from the pattern.
|
|
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. Note that it is often more convenient to construct a RegexMatcher directly from a pattern string rather than separately compiling the pattern and then creating a RegexMatcher object from the 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.
Implements UObject. |
|
ICU "poor man's RTTI", returns a UClassID for this class.
|
|
Creates a RegexMatcher that will match against this pattern. The RegexMatcher can be used to perform match, find or replace operations. Note that a RegexPattern object must not be deleted while RegexMatchers created from it still exist and might possibly be used again.
|
|
Creates a RegexMatcher that will match the given input against this pattern. The RegexMatcher can then be used to perform match, find or replace operations on the input. Note that a RegexPattern object must not be deleted while RegexMatchers created from it still exist and might possibly be used again. The matcher will retain a reference to the supplied input string, and all regexp pattern matching operations happen directly on this original string. It is critical that the string not be altered or deleted before use by the regular expression operations is complete.
|
|
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 RegexMatcher object.
|
|
Comparison operator. Two RegexPattern objects are considered equal if they were constructed from identical source patterns using the same match flag settings.
Definition at line 149 of file regex.h. References UBool, UChar, UChar32, UClassID, and UErrorCode. |
|
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 into fields. Somewhat like split() from Perl. The pattern matches identify delimiters that separate the input into fields. The input data between the matches becomes the fields themselves.
For the best performance on split() operations,
|