Base Framework
|
Regular expression. More...
#include <base/string/RegExp.h>
Inherits Object.
Classes | |
class | RegExpException |
Regular expression exception. More... | |
class | Substring |
Substring descriptor. More... | |
Public Member Functions | |
RegExp () noexcept | |
RegExp (const String &pattern, bool caseSensitivity=true) | |
bool | isCaseSensitive () const noexcept |
bool | isValid () const noexcept |
const String & | getPattern () const noexcept |
void | setCaseSensitivity (bool _caseSensitive) noexcept |
void | setPattern (const String &pattern) |
bool | doesMatch (const String &value, MemorySize start=0) const |
Substring | match (const String &value, MemorySize start=0) const |
Substring | match (const String &value, Array< Substring > &arguments, MemorySize start=0) const |
~RegExp () noexcept | |
Static Public Member Functions | |
static bool | isRegularExpression (const String &pattern, bool caseSensitive=true) noexcept |
Protected Member Functions | |
void | compile () |
void | release () noexcept |
Regular expression.
Regular expression pattern matching.
|
noexcept |
Initializes the regular expression in case sensitive mode.
RegExp::RegExp | ( | const String & | pattern, |
bool | caseSensitivity = true |
||
) |
Initializes the regular expression with the specified pattern.
pattern | The pattern. |
caseSensitive | Specifies the case sensitivity. Default is true. |
|
inlinenoexcept |
Destroys the regular expression.
|
protected |
Compiles the regular expression.
bool RegExp::doesMatch | ( | const String & | value, |
MemorySize | start = 0 |
||
) | const |
Returns true if the value matches the pattern.
|
inlinenoexcept |
Returns the pattern.
|
inlinenoexcept |
Returns true if case sensitive.
|
staticnoexcept |
Returns true if the given expression is a valid regular expression.
|
inlinenoexcept |
Returns true if the regular expression is valid.
Substring RegExp::match | ( | const String & | value, |
Array< Substring > & | arguments, | ||
MemorySize | start = 0 |
||
) | const |
Matches the specified string with the regular expression. Raises OutOfRange if the start index exceeds the end of the string to be matched.
value | The string to be matched. |
arguments | The array to receive the captured substrings from the matched string. |
start | The start index. The default is 0. |
Matches the specified string with the regular expression. Raises OutOfRange if the start index exceeds the end of the string to be matched.
value | The string to be matched. |
start | The start index. The default is 0. |
|
protectednoexcept |
Releases any resources.
|
inlinenoexcept |
Sets the case sensitivity mode.
caseSensitive | Specifies the case sensitivity. True selects case sensitive matching. |
void RegExp::setPattern | ( | const String & | pattern | ) |
Sets the pattern of the regular expression.