diff options
author | Samuel Gaist <samuel.gaist@idiap.ch> | 2018-12-03 13:39:15 +0100 |
---|---|---|
committer | Samuel Gaist <samuel.gaist@idiap.ch> | 2018-12-15 13:24:21 +0000 |
commit | 41c1866d3e8d30dfc1e7b29123ff2b834e7489f7 (patch) | |
tree | 31c7dca0ad22d46c2142117cfd3e7961064c2625 /src | |
parent | 649ee12aba2ee92781f0ab888d21a1bdb440b7da (diff) |
Fix QRegularExpressionMatch capture-related documentation
The documentation is not explicit enough about the content of the
returned list of capturedList nor the element 0 when calling captured or
its friends.
The first element (aka element 0) is the whole string captured when one
or more groups are used.
Change-Id: I3c59ebfc9f6d762dd4d8aaf8f5c0de24359f53d7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/tools/qregularexpression.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp index 831fa28de0..bdaa2d3243 100644 --- a/src/corelib/tools/qregularexpression.cpp +++ b/src/corelib/tools/qregularexpression.cpp @@ -2138,6 +2138,9 @@ int QRegularExpressionMatch::lastCapturedIndex() const If the \a nth capturing group did not capture a string, or if there is no such capturing group, returns a null QString. + \note The implicit capturing group number 0 captures the substring matched + by the entire pattern. + \sa capturedRef(), capturedView(), lastCapturedIndex(), capturedStart(), capturedEnd(), capturedLength(), QString::isNull() */ @@ -2160,6 +2163,9 @@ QString QRegularExpressionMatch::captured(int nth) const If the \a nth capturing group did not capture a string, or if there is no such capturing group, returns a null QStringRef. + \note The implicit capturing group number 0 captures the substring matched + by the entire pattern. + \sa captured(), capturedView(), lastCapturedIndex(), capturedStart(), capturedEnd(), capturedLength(), QStringRef::isNull() */ @@ -2184,6 +2190,9 @@ QStringRef QRegularExpressionMatch::capturedRef(int nth) const If the \a nth capturing group did not capture a string, or if there is no such capturing group, returns a null QStringView. + \note The implicit capturing group number 0 captures the substring matched + by the entire pattern. + \sa captured(), capturedRef(), lastCapturedIndex(), capturedStart(), capturedEnd(), capturedLength(), QStringView::isNull() */ @@ -2296,7 +2305,9 @@ QStringView QRegularExpressionMatch::capturedView(QStringView name) const /*! Returns a list of all strings captured by capturing groups, in the order - the groups themselves appear in the pattern string. + the groups themselves appear in the pattern string. The list includes the + implicit capturing group number 0, capturing the substring matched by the + entire pattern. */ QStringList QRegularExpressionMatch::capturedTexts() const { |