summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qstring.h
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2012-10-14 17:10:43 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-01-14 10:26:59 +0100
commit9110d4f1ed65f02d8bbcb81ed0634d5a38c2bf9f (patch)
treee79ac59ef66baf8c545de8d5bd383eaa15d47cb5 /src/corelib/tools/qstring.h
parent65fba49d639fe2499d66374486f16269e669daf0 (diff)
QString::contains overload that returns the match results
This convenience overload allows one to write QRegularExpression re1, re2, ...; QRegularExpressionMatch match; QString subject; if (subject.contains(re1, &match)) { // ... } else if (subject.contains(re2, &match)) { // ... } // .. One can then inspect the results of a successful match in each block (as well as extracting the captured substrings, etc.). Change-Id: I0fb8be8b577656e8db994198f8105c26c4fe67b0 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qstring.h')
-rw-r--r--src/corelib/tools/qstring.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index 574285fa1e..b7a08928b3 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -72,6 +72,7 @@ QT_BEGIN_NAMESPACE
class QCharRef;
class QRegExp;
class QRegularExpression;
+class QRegularExpressionMatch;
class QString;
class QStringList;
class QTextCodec;
@@ -339,6 +340,7 @@ public:
int indexOf(const QRegularExpression &re, int from = 0) const;
int lastIndexOf(const QRegularExpression &re, int from = -1) const;
bool contains(const QRegularExpression &re) const;
+ bool contains(const QRegularExpression &re, QRegularExpressionMatch *match) const;
int count(const QRegularExpression &re) const;
#endif