summaryrefslogtreecommitdiffstats
path: root/src/corelib/doc/snippets
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2019-06-23 15:20:33 +0200
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2019-06-23 15:52:41 +0200
commit15a1d36b1a209e7f169955d7f8f1b64115d20e6e (patch)
treeeb74d1d90a970654ceb69a12c4720e3451aeba72 /src/corelib/doc/snippets
parent7eb070b4504e9a3cfac8aee582e84105cd8ebe04 (diff)
QRegularExpression docs: streamline the anchoredPattern section
Users may get confounded by the "essay" about exact matching. We now have a function to build a pattern to do exact matching, just state that that's the solution, end of the story. Change-Id: I0a72aa2255af50a1991540b834f146b6e6bc912e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Diffstat (limited to 'src/corelib/doc/snippets')
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_tools_qregularexpression.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qregularexpression.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qregularexpression.cpp
index afdd9c3d25..99cd4ea7a2 100644
--- a/src/corelib/doc/snippets/code/src_corelib_tools_qregularexpression.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_tools_qregularexpression.cpp
@@ -286,15 +286,11 @@ if (!invalidRe.isValid()) {
{
//! [24]
-QRegularExpression re("^this pattern must match exactly$");
-//! [24]
-}
-
-{
-//! [25]
QString p("a .*|pattern");
-QRegularExpression re("\\A(?:" + p + ")\\z"); // re matches exactly the pattern string p
-//! [25]
+
+// re matches exactly the pattern string p
+QRegularExpression re(QRegularExpression::anchoredPattern(p));
+//! [24]
}
{