|
class RegexMatch
Used to retrieve the position of matched regular expression pattern and eventually positions of any subexpressions.
void Clear()
Clears results (GetCount() == 0).
int GetCount() const
Returns the number of matched positions.
int GetOffset(int i = 0) const
Returns the offset in the text of matched (sub)expression i. 0 returns the offset of the whole regular expression.
int GetLength(int i = 0) const
Returns the length of matched (sub)expression i. 0 returns the length of the whole regular expression.
String GetString(const String& text, int i) const
Returns the matched text. text should be the same String that was used in Regex::Match.
WString GetString(const WString& text, int i) const
Returns the matched text. text should be the same String that was used in WRegex::Match.
class Regex
Regular expressions, using PCRE2 library. Regex works with UTF8 by default.
String GetLastErrorText() const
Returns pattern parsing errors (if any).
bool Set(dword options, const char *pattern, int len)
bool Set(dword options, const char *pattern)
bool Set(dword options, const String& pattern)
bool Set(const char *pattern, int len)
bool Set(const char *pattern)
bool Set(const String& pattern)
Sets the pattern to match. options are defined by PCRE2 library. pattern is the regular expression to match. When len is specified, it is the number of pattern characters.
bool Match(const char *text, int len, RegexMatch& match) const
bool Match(const char *text, RegexMatch& match) const
bool Match(const String& text, RegexMatch& match) const
bool Match(const char *text, int len) const
bool Match(const char *text) const
bool Match(const String& text) const
Tries to find pattern in text. Returns true if found. len can specify the number of characters. Use match to retrieve matched expression positions in the text; if there are suppatterns (designated by "()" parenthesis), they are returned as subsequent positions in the match.
Regex()
Default constructor. Use Set to set the pattern.
Regex(dword options, const char *pattern, int len)
Regex(dword options, const char *pattern)
Regex(dword options, const String& pattern)
Regex(const char *pattern, int len)
Regex(const char *pattern)
Regex(const String& pattern)
Sets the pattern to match. options are defined by PCRE2 library. pattern is the regular expression to match. When len is specified, it is the number of pattern characters.
class WRegex
Regular expressions, using PCRE2 library. WRegex works with UTF32 by default.
String GetLastErrorText() const
Returns pattern parsing errors (if any).
bool Set(dword options, const wchar *pattern, int len)
bool Set(dword options, const wchar *pattern)
bool Set(dword options, const WString& pattern)
bool Set(const wchar *pattern, int len)
bool Set(const wchar *pattern)
bool Set(const WString& pattern)
Sets the pattern to match. options are defined by PCRE2 library. pattern is the regular expression to match. When len is specified, it is the number of pattern characters.
bool Match(const wchar *text, int len, RegexMatch& match) const
bool Match(const wchar *text, RegexMatch& match) const
bool Match(const WString& text, RegexMatch& match) const
bool Match(const wchar *text, int len) const
bool Match(const wchar *text) const
bool Match(const WString& text) const
Tries to find pattern in text. Returns true if found. len can specify the number of characters. Use match to retrieve matched expression positions in the text; if there are suppatterns (designated by "()" parenthesis), they are returned as subsequent positions in the match.
WRegex()
Default constructor. Use Set to set the pattern.
WRegex(dword options, const wchar *pattern, int len)
WRegex(dword options, const wchar *pattern)
WRegex(dword options, const WString& pattern)
WRegex(const wchar *pattern, int len)
WRegex(const wchar *pattern)
WRegex(const WString& pattern)
Sets the pattern to match. options are defined by PCRE2 library. pattern is the regular expression to match. When len is specified, it is the number of pattern characters.
|