summaryrefslogtreecommitdiffstats
path: root/src/corelib/doc
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/doc')
-rw-r--r--src/corelib/doc/snippets/qstring/main.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/corelib/doc/snippets/qstring/main.cpp b/src/corelib/doc/snippets/qstring/main.cpp
index bf45a31c29..f5c6b69695 100644
--- a/src/corelib/doc/snippets/qstring/main.cpp
+++ b/src/corelib/doc/snippets/qstring/main.cpp
@@ -394,6 +394,13 @@ void Widget::firstIndexOfFunction()
QString str = "the minimum";
str.indexOf(QRegularExpression("m[aeiou]"), 0); // returns 4
//! [93]
+
+ //! [97]
+ QString str = "the minimum";
+ QRegularExpressionMatch match;
+ str.indexOf(QRegularExpression("m[aeiou]"), 0, &match); // returns 4
+ // match.captured() == mi
+ //! [97]
}
void Widget::insertFunction()
@@ -444,6 +451,13 @@ void Widget::lastIndexOfFunction()
QString str = "the minimum";
str.lastIndexOf(QRegularExpression("m[aeiou]")); // returns 8
//! [94]
+
+ //! [98]
+ QString str = "the minimum";
+ QRegularExpressionMatch match;
+ str.lastIndexOf(QRegularExpression("m[aeiou]"), -1, &match); // returns 8
+ // match.captured() == mu
+ //! [98]
}
void Widget::leftFunction()