47#if U_SHOW_CPLUSPLUS_API
49#if !UCONFIG_NO_REGULAR_EXPRESSIONS
519 int32_t destCapacity,
563 int32_t destCapacity,
589 UVector64 *fCompiledPat;
594 Regex8BitSet *fSets8;
600 int32_t fMinMatchLen;
612 UVector32 *fGroupMap;
616 int32_t fInitialStringIdx;
617 int32_t fInitialStringLen;
620 Regex8BitSet *fInitialChars8;
621 UBool fNeedsAltInput;
625 friend class RegexCompile;
627 friend class RegexCImpl;
633 bool initNamedCaptureMap();
636 void dumpOp(int32_t index)
const;
639#ifndef U_HIDE_INTERNAL_API
1567 int32_t destCapacity,
1596 int32_t destCapacity,
1677 const void *context,
1692 const void *&context,
1710 const void *context,
1725 const void *&context,
1728#ifndef U_HIDE_INTERNAL_API
1762 friend class RegexCImpl;
1764#ifndef U_HIDE_INTERNAL_API
1775 inline void backTrack(int64_t &inputIdx, int32_t &patIdx);
1776 UBool isWordBoundary(int64_t pos);
1779 int64_t followingGCBoundary(int64_t pos,
UErrorCode &status);
1780 REStackFrame *resetStack();
1781 inline REStackFrame *StateSave(REStackFrame *fp, int64_t savePatIdx,
UErrorCode &status);
1785 inline UBool findProgressInterrupt(int64_t matchIndex,
UErrorCode &status);
1787 int64_t appendGroup(int32_t groupNum,
UText *dest,
UErrorCode &status)
const;
1791 UBool isChunkWordBoundary(int32_t pos);
1799 UText *fAltInputText;
1801 int64_t fInputLength;
1804 int64_t fRegionStart;
1805 int64_t fRegionLimit;
1807 int64_t fAnchorStart;
1808 int64_t fAnchorLimit;
1814 int64_t fActiveStart;
1815 int64_t fActiveLimit;
1819 UBool fTransparentBounds;
1820 UBool fAnchoringBounds;
1823 int64_t fMatchStart;
1827 int64_t fLastMatchEnd;
1829 int64_t fAppendPosition;
1838 REStackFrame *fFrame;
1843 int64_t fSmallData[8];
1849 int32_t fTickCounter;
1854 int32_t fStackLimit;
1859 const void *fCallbackContext;
1863 const void *fFindProgressCallbackContext;
1866 UBool fInputUniStrMaybeMutable;
The BreakIterator class implements methods for finding the location of boundaries in text.
class RegexMatcher bundles together a regular expression pattern and input text to which the expressi...
virtual int64_t end64(int32_t group, UErrorCode &status) const
Returns the index in the input string of the character following the text matched by the specified ca...
virtual UText * inputText() const
Returns the input string being matched.
static UClassID getStaticClassID()
ICU "poor man's RTTI", returns a UClassID for this class.
virtual UBool hasTransparentBounds() const
Queries the transparency of region bounds for this matcher.
void resetPreserveRegion()
virtual UBool hasAnchoringBounds() const
Return true if this matcher is using anchoring bounds.
virtual int32_t end(UErrorCode &status) const
Returns the index in the input string of the first character following the text matched during the pr...
virtual UnicodeString replaceFirst(const UnicodeString &replacement, UErrorCode &status)
Replaces the first substring of the input that matches the pattern with the replacement string.
virtual void getMatchCallback(URegexMatchCallback *&callback, const void *&context, UErrorCode &status)
Get the callback function for this URegularExpression.
virtual RegexMatcher & reset()
Resets this matcher.
virtual int32_t groupCount() const
Returns the number of capturing groups in this matcher's pattern.
virtual UnicodeString group(UErrorCode &status) const
Returns a string containing the text matched by the previous match.
virtual const RegexPattern & pattern() const
Returns the pattern that is interpreted by this matcher.
virtual UnicodeString replaceAll(const UnicodeString &replacement, UErrorCode &status)
Replaces every substring of the input that matches the pattern with the given replacement string.
virtual void setFindProgressCallback(URegexFindProgressCallback *callback, const void *context, UErrorCode &status)
Set a progress callback function for use with find operations on this Matcher.
virtual UText * getInput(UText *dest, UErrorCode &status) const
Returns the input string being matched, either by copying it into the provided UText parameter or by ...
virtual int32_t split(const UnicodeString &input, UnicodeString dest[], int32_t destCapacity, UErrorCode &status)
Split a string into fields.
virtual UBool lookingAt(int64_t startIndex, UErrorCode &status)
Attempts to match the input string, starting from the specified index, against the pattern.
virtual UBool matches(int64_t startIndex, UErrorCode &status)
Resets the matcher, then attempts to match the input beginning at the specified startIndex,...
virtual int32_t start(UErrorCode &status) const
Returns the index in the input string of the start of the text matched during the previous match oper...
virtual UBool find()
Find the next pattern match in the input string.
RegexMatcher(UText *regexp, UText *input, uint32_t flags, UErrorCode &status)
Construct a RegexMatcher for a regular expression.
RegexMatcher(const UnicodeString ®exp, const UnicodeString &input, uint32_t flags, UErrorCode &status)
Construct a RegexMatcher for a regular expression.
virtual RegexMatcher & region(int64_t regionStart, int64_t regionLimit, int64_t startIndex, UErrorCode &status)
Identical to region(start, limit, status) but also allows a start position without resetting the regi...
virtual int32_t getTimeLimit() const
Get the time limit, if any, for match operations made with this Matcher.
virtual void setTimeLimit(int32_t limit, UErrorCode &status)
Set a processing time limit for match operations with this Matcher.
virtual void setMatchCallback(URegexMatchCallback *callback, const void *context, UErrorCode &status)
Set a callback function for use with this Matcher.
virtual RegexMatcher & reset(UText *input)
Resets this matcher with a new input string.
virtual int64_t regionStart64() const
Reports the start index of this matcher's region.
virtual UText * appendTail(UText *dest, UErrorCode &status)
As the final step in a find-and-replace operation, append the remainder of the input string,...
virtual int32_t start(int32_t group, UErrorCode &status) const
Returns the index in the input string of the start of the text matched by the specified capture group...
virtual ~RegexMatcher()
Destructor.
virtual UText * group(UText *dest, int64_t &group_len, UErrorCode &status) const
Returns a shallow clone of the entire live input string with the UText current native index set to th...
virtual RegexMatcher & useAnchoringBounds(UBool b)
Set whether this matcher is using Anchoring Bounds for its region.
virtual UBool lookingAt(UErrorCode &status)
Attempts to match the input string, starting from the beginning of the region, against the pattern.
virtual UText * group(int32_t groupNum, UText *dest, int64_t &group_len, UErrorCode &status) const
Returns a shallow clone of the entire live input string with the UText current native index set to th...
virtual int64_t regionEnd64() const
Reports the end (limit) index (exclusive) of this matcher's region.
virtual UnicodeString & appendTail(UnicodeString &dest)
As the final step in a find-and-replace operation, append the remainder of the input string,...
virtual RegexMatcher & reset(const UnicodeString &input)
Resets this matcher with a new input string.
virtual UBool find(UErrorCode &status)
Find the next pattern match in the input string.
RegexMatcher(UText *regexp, uint32_t flags, UErrorCode &status)
Construct a RegexMatcher for a regular expression.
virtual RegexMatcher & region(int64_t start, int64_t limit, UErrorCode &status)
Sets the limits of this matcher's region.
virtual UBool matches(UErrorCode &status)
Attempts to match the entire input region against the pattern.
void setTrace(UBool state)
setTrace Debug function, enable/disable tracing of the matching engine.
virtual RegexMatcher & reset(int64_t index, UErrorCode &status)
Resets this matcher, and set the current input position.
virtual UClassID getDynamicClassID() const override
ICU "poor man's RTTI", returns a UClassID for the actual class.
virtual int32_t split(UText *input, UText *dest[], int32_t destCapacity, UErrorCode &status)
Split a string into fields.
RegexMatcher(const UnicodeString ®exp, uint32_t flags, UErrorCode &status)
Construct a RegexMatcher for a regular expression.
virtual int32_t getStackLimit() const
Get the size of the heap storage available for use by the back tracking stack.
virtual int32_t end(int32_t group, UErrorCode &status) const
Returns the index in the input string of the character following the text matched by the specified ca...
virtual RegexMatcher & appendReplacement(UnicodeString &dest, const UnicodeString &replacement, UErrorCode &status)
Implements a replace operation intended to be used as part of an incremental find-and-replace.
virtual RegexMatcher & appendReplacement(UText *dest, UText *replacement, UErrorCode &status)
Implements a replace operation intended to be used as part of an incremental find-and-replace.
virtual RegexMatcher & useTransparentBounds(UBool b)
Sets the transparency of region bounds for this matcher.
virtual int64_t start64(UErrorCode &status) const
Returns the index in the input string of the start of the text matched during the previous match oper...
virtual int64_t end64(UErrorCode &status) const
Returns the index in the input string of the first character following the text matched during the pr...
virtual UText * replaceAll(UText *replacement, UText *dest, UErrorCode &status)
Replaces every substring of the input that matches the pattern with the given replacement string.
virtual void setStackLimit(int32_t limit, UErrorCode &status)
Set the amount of heap storage available for use by the match backtracking stack.
virtual const UnicodeString & input() const
Returns the input string being matched.
virtual UText * replaceFirst(UText *replacement, UText *dest, UErrorCode &status)
Replaces the first substring of the input that matches the pattern with the replacement string.
virtual int32_t regionEnd() const
Reports the end (limit) index (exclusive) of this matcher's region.
virtual int64_t start64(int32_t group, UErrorCode &status) const
Returns the index in the input string of the start of the text matched by the specified capture group...
virtual void getFindProgressCallback(URegexFindProgressCallback *&callback, const void *&context, UErrorCode &status)
Get the find progress callback function for this URegularExpression.
virtual UBool hitEnd() const
Return true if the most recent matching operation attempted to access additional input beyond the ava...
virtual UBool requireEnd() const
Return true the most recent match succeeded and additional input could cause it to fail.
virtual UBool find(int64_t start, UErrorCode &status)
Resets this RegexMatcher and then attempts to find the next substring of the input string that matche...
virtual int32_t regionStart() const
Reports the start index of this matcher's region.
virtual UnicodeString group(int32_t groupNum, UErrorCode &status) const
Returns a string containing the text captured by the given group during the previous match operation.
virtual RegexMatcher & refreshInputText(UText *input, UErrorCode &status)
Set the subject text string upon which the regular expression is looking for matches without changing...
Class RegexPattern represents a compiled regular expression.
static RegexPattern * compile(UText *regex, uint32_t flags, UErrorCode &status)
Compiles the regular expression in string form into a RegexPattern object using the specified URegexp...
virtual UClassID getDynamicClassID() const override
ICU "poor man's RTTI", returns a UClassID for the actual class.
virtual RegexMatcher * matcher(const UnicodeString &input, UErrorCode &status) const
Creates a RegexMatcher that will match the given input against this pattern.
virtual ~RegexPattern()
Destructor.
virtual uint32_t flags() const
Get the URegexpFlag match mode flags that were used when compiling this pattern.
void dumpPattern() const
Dump a compiled pattern.
static 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 URegexp...
virtual RegexPattern * clone() const
Create an exact copy of this RegexPattern object.
static UBool matches(UText *regex, UText *input, UParseError &pe, UErrorCode &status)
Test whether a string matches a regular expression.
static RegexPattern * compile(UText *regex, uint32_t flags, UParseError &pe, UErrorCode &status)
Compiles the regular expression in string form into a RegexPattern object using the specified URegexp...
virtual RegexMatcher * matcher(UErrorCode &status) const
Creates a RegexMatcher that will match against this pattern.
bool operator!=(const RegexPattern &that) const
Comparison operator.
static UClassID getStaticClassID()
ICU "poor man's RTTI", returns a UClassID for this class.
virtual int32_t split(const UnicodeString &input, UnicodeString dest[], int32_t destCapacity, UErrorCode &status) const
Split a string into fields.
virtual int32_t split(UText *input, UText *dest[], int32_t destCapacity, UErrorCode &status) const
Split a string into fields.
static RegexPattern * compile(const UnicodeString ®ex, uint32_t flags, UErrorCode &status)
Compiles the regular expression in string form into a RegexPattern object using the specified URegexp...
static UBool matches(const UnicodeString ®ex, const UnicodeString &input, UParseError &pe, UErrorCode &status)
Test whether a string matches a regular expression.
virtual int32_t groupNumberFromName(const UnicodeString &groupName, UErrorCode &status) const
Get the group number corresponding to a named capture group.
RegexPattern(const RegexPattern &source)
Copy Constructor.
static RegexPattern * compile(UText *regex, UParseError &pe, UErrorCode &status)
Compiles the regular expression in string form into a RegexPattern object.
bool operator==(const RegexPattern &that) const
Comparison operator.
RegexPattern()
default constructor.
virtual UText * patternText(UErrorCode &status) const
Returns the regular expression from which this pattern was compiled.
virtual UnicodeString pattern() const
Returns the regular expression from which this pattern was compiled.
static RegexPattern * compile(const UnicodeString ®ex, UParseError &pe, UErrorCode &status)
Compiles the regular expression in string form into a RegexPattern object.
virtual int32_t groupNumberFromName(const char *groupName, int32_t nameLength, UErrorCode &status) const
Get the group number corresponding to a named capture group.
UObject is the common ICU "boilerplate" class.
A mutable set of Unicode characters and multicharacter strings.
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
struct UHashtable UHashtable
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
C API: Parse Error Information.
A UParseError struct is used to returned detailed information about parsing errors.
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
int8_t UBool
The ICU boolean type, a signed-byte integer.
#define U_FINAL
Defined to the C++11 "final" keyword if available.
C++ API: Common ICU base class UObject.
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
C API: Regular Expressions.
UBool URegexFindProgressCallback(const void *context, int64_t matchIndex)
Function pointer for a regular expression find callback function.
UBool URegexMatchCallback(const void *context, int32_t steps)
Function pointer for a regular expression matching callback function.
C API: Abstract Unicode Text API.
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside.