diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-04-02 14:21:06 +0200 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-04-03 21:49:57 +0200 |
commit | 91218299166942548cd0c1776d391f565249b112 (patch) | |
tree | ad11467030b3aa5d179d231c3ef291b9863fd8b6 /src/corelib/text/qregularexpression.cpp | |
parent | 1812830ac3d5b167ddbb998cef58096d47da9989 (diff) |
QRegularExpression: rename AnchoredMatchOption to AnchorAtOffsetMatchOption
The name of the option may cause confusion due to the fact
that it's not _fully_ anchoring the match, only anchoring it
at the offset passed to match() -- in other words, it's a
"left" anchoring. Deprecate the old name and introduce
a new one that should explain the situation better.
[ChangeLog][QtCore][QRegularExpression] The AnchoredMatchOption
match option has been deprecated in favor of
AnchorAtOffsetMatchOption, which should better describe
that the match is only anchored at the offset.
Change-Id: Ib751e5e488f2d0309a2da6496378247dfa4648de
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Diffstat (limited to 'src/corelib/text/qregularexpression.cpp')
-rw-r--r-- | src/corelib/text/qregularexpression.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/corelib/text/qregularexpression.cpp b/src/corelib/text/qregularexpression.cpp index 003bc59e1c..6544abb646 100644 --- a/src/corelib/text/qregularexpression.cpp +++ b/src/corelib/text/qregularexpression.cpp @@ -553,7 +553,7 @@ QT_BEGIN_NAMESPACE \section2 Caret modes - The AnchoredMatchOption match option can be used to emulate the + The AnchorAtOffsetMatchOption match option can be used to emulate the QRegExp::CaretAtOffset behaviour. There is no equivalent for the other QRegExp::CaretMode modes. @@ -788,9 +788,16 @@ QT_BEGIN_NAMESPACE No match options are set. \value AnchoredMatchOption + Use AnchorAtOffsetMatchOption instead. + + \value AnchorAtOffsetMatchOption The match is constrained to start exactly at the offset passed to match() in order to be successful, even if the pattern string does not contain any metacharacter that anchors the match at that point. + Note that passing this option does not anchor the end of the match + to the end of the subject; if you want to fully anchor a regular + expression, use anchoredPattern(). + This enum value has been introduced in Qt 6.0. \value DontCheckSubjectStringMatchOption The subject string is not checked for UTF-16 validity before @@ -832,7 +839,7 @@ static int convertToPcreOptions(QRegularExpression::MatchOptions matchOptions) { int options = 0; - if (matchOptions & QRegularExpression::AnchoredMatchOption) + if (matchOptions & QRegularExpression::AnchorAtOffsetMatchOption) options |= PCRE2_ANCHORED; if (matchOptions & QRegularExpression::DontCheckSubjectStringMatchOption) options |= PCRE2_NO_UTF_CHECK; |