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>
bb10
Samuel Gaist 2018-12-03 13:39:15 +01:00
parent 649ee12aba
commit 41c1866d3e
1 changed files with 12 additions and 1 deletions

View File

@ -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
{