The Match
Class Reference
Object representing the matching results. More...
Declaration
Included Headers
Friends Index
class | Ex |
Public Constructors Index
Match () | |
Creates an empty match object. More... | |
Public Operators Index
const SubMatch & | operator[] (size_t index) const |
Public Member Functions Index
size_t | position () const |
Returns the position of the match or std::string::npos if no position is set. More... | |
size_t | length () const |
Returns the position of the match or std::string::npos if no length is set. More... | |
std::string | str () const |
Return a string representing the matching part. More... | |
SubMatch | prefix () const |
Return the part of the string before the match. More... | |
SubMatch | suffix () const |
Return the part of the string after the match. More... | |
size_t | size () const |
Returns the number of sub matches available in this match. More... | |
Private Member Functions Index
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 Member Attributes Index
std::vector< SubMatch > | m_subMatches |
size_t | m_captureIndex =0 |
std::string_view | m_str |
bool | m_insideCapture =false |
Description
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.
Definition at line 152 of file regex.h.
Public Operators
operator[]()
| 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.
Reference m_subMatches.
Public Member Functions
length()
| inline |
Returns the position of the match or std::string::npos if no length is set.
Definition at line 162 of file regex.h.
Reference m_subMatches.
Referenced by reg::Ex::Private::matchAt and suffix.
position()
| inline |
Returns the position of the match or std::string::npos if no position is set.
Definition at line 159 of file regex.h.
Reference m_subMatches.
prefix()
| inline |
size()
| inline |
Returns the number of sub matches available in this match.
Definition at line 183 of file regex.h.
Reference m_subMatches.
str()
| inline |
Return a string representing the matching part.
Definition at line 165 of file regex.h.
Reference m_subMatches.
Referenced by init and initPredefined.
suffix()
Private Member Functions
endCapture()
| inline |
Definition at line 209 of file regex.h.
References m_captureIndex, m_insideCapture and m_subMatches.
init()
| inline |
Definition at line 192 of file regex.h.
References m_str, m_subMatches and str.
Referenced by reg::Ex::Private::matchAt.
setMatch()
| inline |
Definition at line 218 of file regex.h.
References m_captureIndex and m_subMatches.
startCapture()
| inline |
Definition at line 198 of file regex.h.
References m_captureIndex, m_insideCapture, m_str and m_subMatches.
Private Member Attributes
m_captureIndex
|
Definition at line 224 of file regex.h.
Referenced by endCapture, setMatch and startCapture.
m_insideCapture
|
Definition at line 226 of file regex.h.
Referenced by endCapture and startCapture.
m_str
|
m_subMatches
|
Definition at line 223 of file regex.h.
Referenced by endCapture, init, length, operator[], position, setMatch, size, startCapture and str.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus by Doxygen 1.14.0.