Doxygen
|
Object representing the matching results. More...
#include <src/regex.h>
Public Member Functions | |
Match () | |
Creates an empty match object. | |
size_t | position () const |
Returns the position of the match or std::string::npos if no position is set. | |
size_t | length () const |
Returns the position of the match or std::string::npos if no length is set. | |
std::string | str () const |
Return a string representing the matching part. | |
SubMatch | prefix () const |
Return the part of the string before the match. | |
SubMatch | suffix () const |
Return the part of the string after the match. | |
size_t | size () const |
Returns the number of sub matches available in this match. | |
const SubMatch & | operator[] (size_t index) const |
Returns the n-th SubMatch object. | |
Private Member Functions | |
void | init (std::string_view str) |
void | startCapture (size_t index) |
void | endCapture (size_t index) |
void | setMatch (size_t pos, size_t len) |
Private Attributes | |
std::vector< SubMatch > | m_subMatches |
size_t | m_captureIndex =0 |
std::string_view | m_str |
bool | m_insideCapture =false |
Friends | |
class | Ex |
Object representing the matching results.
It consists of an array of SubMatch objects. The first entry of the array represents the whole match, any next elements represent each of the capture ranges.
For example string @42
and expression @(\\d+)
will have two Submatches, match[0] will point to the input string as a whole, and match[1] will point to the number 42 only.
|
inline |
|
inlineprivate |
Definition at line 209 of file regex.h.
References m_captureIndex, m_insideCapture, and m_subMatches.
|
inlineprivate |
Definition at line 192 of file regex.h.
References m_str, m_subMatches, and str().
Referenced by reg::Ex::Private::matchAt().
|
inline |
Returns the position of the match or std::string::npos if no length is set.
Definition at line 162 of file regex.h.
References m_subMatches.
Referenced by reg::Ex::Private::matchAt(), and suffix().
|
inline |
Returns the n-th SubMatch object.
Note that there is always 1 SubMatch object representing the whole match.
Definition at line 188 of file regex.h.
References m_subMatches.
|
inline |
Returns the position of the match or std::string::npos if no position is set.
Definition at line 159 of file regex.h.
References m_subMatches.
|
inline |
Return the part of the string before the match.
Definition at line 168 of file regex.h.
References m_str, position(), and reg::SubMatch::setMatch().
|
inlineprivate |
Definition at line 218 of file regex.h.
References m_captureIndex, and m_subMatches.
|
inline |
Returns the number of sub matches available in this match.
Definition at line 183 of file regex.h.
References m_subMatches.
|
inlineprivate |
Definition at line 198 of file regex.h.
References m_captureIndex, m_insideCapture, m_str, and m_subMatches.
|
inline |
Return a string representing the matching part.
Definition at line 165 of file regex.h.
References m_subMatches.
Referenced by containsWord(), init(), and initPredefined().
|
inline |
Return the part of the string after the match.
Definition at line 171 of file regex.h.
References length(), m_str, position(), and reg::SubMatch::setMatch().
|
private |
Definition at line 224 of file regex.h.
Referenced by endCapture(), setMatch(), and startCapture().
|
private |
Definition at line 226 of file regex.h.
Referenced by endCapture(), and startCapture().
|
private |
|
private |
Definition at line 223 of file regex.h.
Referenced by endCapture(), init(), length(), operator[](), position(), setMatch(), size(), startCapture(), and str().