#include <lib_std_regex.h>
Represents a result for matching a string against an expression.
maxon::RegexInterface::Match
, other regex functions use other means of conveying their output.A RegexMatch
does not encapsulate a list of matches (as for example done by std::smatch
or Python's re.Match
) but a singular match. But Regex.Match
operates with a collection of RegexMatch
objects to realize the 'sequence of matches' aspect; for example when an expression contains multiple groups. The maxon::regex
implementation does not support named capture groups and matches have therefore no capture group name field.
Public Member Functions | |
RegexMatch (const String &string_, Int index_) | |
Bool | IsFullMatch () const |
Bool | IsEmptyMatch () const |
Public Attributes | |
const String | string |
const Int | index |
RegexMatch | ( | const String & | string_, |
Int | index_ | ||
) |
Constructs a match with the given match string and index.
[in] | string_ | The matched (sub)string. |
[in] | index_ | The index of the match. |
Bool IsFullMatch | ( | ) | const |
Checks if the match has the index 0
, i.e., if it is the full match of a match sequence.
Bool IsEmptyMatch | ( | ) | const |
Checks if the match is the empty string.
const String string |
The (sub)string in the input string that matches the expression or a group in the expression.
const Int index |
The index of a match within a match sequence, 0
for the full match of a sequence, 1
for the first group, and so on. This value will be identical to the index of the element in the list of matches, when for example a BaseArray<RegexMatch>
is used as the value receiver of the operation.