RegexMatch Class Reference

#include <lib_std_regex.h>

Detailed Description

Represents a result for matching a string against an expression.

Note
Only relevant in the context of 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
 

Constructor & Destructor Documentation

◆ RegexMatch()

RegexMatch ( const String string_,
Int  index_ 
)

Constructs a match with the given match string and index.

Parameters
[in]string_The matched (sub)string.
[in]index_The index of the match.

Member Function Documentation

◆ IsFullMatch()

Bool IsFullMatch ( ) const

Checks if the match has the index 0, i.e., if it is the full match of a match sequence.

◆ IsEmptyMatch()

Bool IsEmptyMatch ( ) const

Checks if the match is the empty string.

Member Data Documentation

◆ string

const String string

The (sub)string in the input string that matches the expression or a group in the expression.

◆ index

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.