D9175: Migrate some more QRegExps to QRegularExpression
Milian Wolff
noreply at phabricator.kde.org
Tue Dec 5 10:45:10 UTC 2017
mwolff added inline comments.
INLINE COMMENTS
> codecompletionmodelcontrollerinterface.cpp:61
>
> - static QRegExp findWordStart(QLatin1String("\\b([_\\w]+)$"));
> - static QRegExp findWordEnd(QLatin1String("^([_\\w]*)\\b"));
> + static QRegularExpression findWordStart(QStringLiteral("\\b[_\\w]+$"));
> + static QRegularExpression findWordEnd(QStringLiteral("^[_\\w]*\\b"));
both const
> katebookmarks.cpp:129
> int line = m_view->cursorPosition().line();
> - const QRegExp re(QLatin1String("&(?!&)"));
> + const QRegularExpression re(QStringLiteral("&(?!&)"));
> int next = -1; // -1 means next bookmark doesn't exist
static?
> katecommandrangeexpressionparser.cpp:119
> QList<bool> operators_list;
> - QStringList split = string.split(QRegExp(QLatin1String("[-+](?!([+-]|$))")));
> + QStringList split = string.split(QRegularExpression(QStringLiteral("[-+](?!([+-]|$))")));
> QList<int> values;
future: splitRef
> katesedcmd.cpp:164
>
> - QString d = delim.cap(1);
> + const QString d = match.captured(1);
> qCDebug(LOG_KTE) << "SedReplace: delimiter is '" << d << "'";
here and below: capturedRef?
> variablelistview.cpp:51
>
> - QRegExp sep(QLatin1String("\\s+"));
> + const QRegularExpression sep(QStringLiteral("\\s+"));
> for (int i = 0; i < variables.size(); ++i) {
static?
> variablelistview.cpp:53
> for (int i = 0; i < variables.size(); ++i) {
> QStringList pair = variables[i].split(sep, QString::SkipEmptyParts);
> if (pair.size() < 2) {
future: splitRef
> kateview.cpp:3595
> */
> - QString regex = QRegExp::escape (m_currentTextForHighlights);
> - if (QRegExp (QStringLiteral("\\b%1").arg(regex)).indexIn (QStringLiteral(" %1 ").arg(m_currentTextForHighlights)) != -1)
> - regex = QStringLiteral("\\b%1").arg(regex);
> - if (QRegExp (QStringLiteral("%1\\b").arg(regex)).indexIn (QStringLiteral(" %1 ").arg(m_currentTextForHighlights)) != -1)
> - regex = QStringLiteral("%1\\b").arg(regex);
> -
> + const QString regex = QStringLiteral("\\b") + QRegularExpression::escape(m_currentTextForHighlights) + QStringLiteral("\\b");
> QVector<KTextEditor::Range> matches;
what was that old code trying to do? did you understand it?
REPOSITORY
R39 KTextEditor
REVISION DETAIL
https://phabricator.kde.org/D9175
To: dhaumann, cullmann, kfunk, mwolff
Cc: #frameworks, kevinapavew, ngraham, demsking, cullmann, sars, dhaumann
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20171205/8406b996/attachment-0001.html>
More information about the Kde-frameworks-devel
mailing list