diff options
Diffstat (limited to 'src/corelib/tools/qregularexpression.cpp')
-rw-r--r-- | src/corelib/tools/qregularexpression.cpp | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp index 1026d4ab28..ca1a866842 100644 --- a/src/corelib/tools/qregularexpression.cpp +++ b/src/corelib/tools/qregularexpression.cpp @@ -1560,15 +1560,11 @@ int QRegularExpression::captureCount() const For instance, given the regular expression - \code - (?<day>\d\d)-(?<month>\d\d)-(?<year>\d\d\d\d) (\w+) (?<name>\w+) - \endcode + \snippet code/src_corelib_tools_qregularexpression.cpp 32 namedCaptureGroups() will return the following list: - \code - ("", "day", "month", "year", "", "name") - \endcode + \snippet code/src_corelib_tools_qregularexpression.cpp 33 which corresponds to the fact that the capturing group #0 (corresponding to the whole match) has no name, the capturing group #1 has name "day", the @@ -1814,7 +1810,7 @@ bool QRegularExpression::operator==(const QRegularExpression &re) const Returns the hash value for \a key, using \a seed to seed the calculation. */ -uint qHash(const QRegularExpression &key, uint seed) Q_DECL_NOTHROW +uint qHash(const QRegularExpression &key, uint seed) noexcept { QtPrivate::QHashCombine hash; seed = hash(seed, key.d->pattern); @@ -1996,7 +1992,7 @@ QString QRegularExpression::wildcardToRegularExpression(const QString &pattern) } } - return rx; + return anchoredPattern(rx); } /*! @@ -2004,8 +2000,8 @@ QString QRegularExpression::wildcardToRegularExpression(const QString &pattern) \since 5.12 - Returns the expression wrapped between the \c{\A} and \c{\z} anchors to be - used for exact matching. + Returns the \a expression wrapped between the \c{\A} and \c{\z} anchors to + be used for exact matching. \sa {Porting from QRegExp's Exact Matching} */ @@ -2142,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() */ @@ -2164,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() */ @@ -2188,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() */ @@ -2300,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 { |