From f19d84f048d4683afc98fb200379a7d33faf569f Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Mon, 7 Dec 2020 01:40:54 +0100 Subject: [PATCH] QString: improve lastIndexOf(QRegularExpression) docs Due to how regex matching works, lastIndexOf has to be implemented by matching from the string's beginning until the from position is reached. This might not be obvious for users, so document that. Task-number: QTBUG-89050 Change-Id: I4b69ea753e7d417d980031926f1e01d77e58720d Reviewed-by: Thiago Macieira (cherry picked from commit 6f2dc8d7f27419d13bfbb2af272af99c03c66562) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/text/qstring.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 1ecda4e3325..f88aad16546 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -4251,6 +4251,10 @@ qsizetype QString::indexOf(const QRegularExpression &re, qsizetype from, QRegula Example: \snippet qstring/main.cpp 94 + + \note Due to how the regular expression matching algorithm works, + this function will actually match repeatedly from the beginning of + the string until the position \a from is reached. */ qsizetype QString::lastIndexOf(const QRegularExpression &re, qsizetype from, QRegularExpressionMatch *rmatch) const {