summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qregexp.cpp
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2020-05-29 12:01:26 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2020-06-04 10:39:52 +0200
commit21549529ef0e80c3dae28b4d7ea9a8ffb859f351 (patch)
tree2e068dc065c56fd252485c977601331d25cef757 /src/corelib/text/qregexp.cpp
parentf439df7893d133261325aa19e6c8b64b41eb0042 (diff)
Rename snippet files to match the carved up corelib/tools/
This is a folllow-up to commits 548513a4bd050d3df0a85fed6e2d1a00ce06d2ab and a9aa206b7b8ac4e69f8c46233b4080e00e845ff5, renaming the snippets files referenced by the files moved out of corelib/tools/ to match the new locations of the files using them. Change-Id: I59f5d3c217ef835e9244387cc769e7212de9d8f5 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'src/corelib/text/qregexp.cpp')
-rw-r--r--src/corelib/text/qregexp.cpp44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/corelib/text/qregexp.cpp b/src/corelib/text/qregexp.cpp
index 9ae96a805ed..68fc0d054f4 100644
--- a/src/corelib/text/qregexp.cpp
+++ b/src/corelib/text/qregexp.cpp
@@ -444,7 +444,7 @@ QT_BEGIN_NAMESPACE
When the number of matches cannot be determined in advance, a
common idiom is to use cap() in a loop. For example:
- \snippet code/src_corelib_tools_qregexp.cpp 0
+ \snippet code/src_corelib_text_qregexp.cpp 0
\target assertions
\section1 Assertions
@@ -538,7 +538,7 @@ QT_BEGIN_NAMESPACE
To test a string against a wildcard expression, use exactMatch().
For example:
- \snippet code/src_corelib_tools_qregexp.cpp 1
+ \snippet code/src_corelib_text_qregexp.cpp 1
\target perl-users
\section1 Notes for Perl Users
@@ -560,7 +560,7 @@ QT_BEGIN_NAMESPACE
applied to all the quantifiers in the pattern. For example, to
match the Perl regexp \b{ro+?m} requires:
- \snippet code/src_corelib_tools_qregexp.cpp 2
+ \snippet code/src_corelib_text_qregexp.cpp 2
The equivalent of Perl's \c{/i} option is
setCaseSensitivity(Qt::CaseInsensitive).
@@ -589,7 +589,7 @@ QT_BEGIN_NAMESPACE
the other hand, C++'s rules for literal strings can be used to
achieve the same:
- \snippet code/src_corelib_tools_qregexp.cpp 3
+ \snippet code/src_corelib_text_qregexp.cpp 3
Both zero-width positive and zero-width negative lookahead
assertions (?=pattern) and (?!pattern) are supported with the same
@@ -608,12 +608,12 @@ QT_BEGIN_NAMESPACE
\target code-examples
\section1 Code Examples
- \snippet code/src_corelib_tools_qregexp.cpp 4
+ \snippet code/src_corelib_text_qregexp.cpp 4
The third string matches '\underline{6}'. This is a simple validation
regexp for integers in the range 0 to 99.
- \snippet code/src_corelib_tools_qregexp.cpp 5
+ \snippet code/src_corelib_text_qregexp.cpp 5
The second string matches '\underline{This_is-OK}'. We've used the
character set abbreviation '\\S' (non-whitespace) and the anchors
@@ -623,25 +623,25 @@ QT_BEGIN_NAMESPACE
'letter' or 'correspondence' but only match whole words i.e. not
'email'
- \snippet code/src_corelib_tools_qregexp.cpp 6
+ \snippet code/src_corelib_text_qregexp.cpp 6
The second string matches "Please write the \underline{letter}". The
word 'letter' is also captured (because of the parentheses). We
can see what text we've captured like this:
- \snippet code/src_corelib_tools_qregexp.cpp 7
+ \snippet code/src_corelib_text_qregexp.cpp 7
This will capture the text from the first set of capturing
parentheses (counting capturing left parentheses from left to
right). The parentheses are counted from 1 since cap(0) is the
whole matched regexp (equivalent to '&' in most regexp engines).
- \snippet code/src_corelib_tools_qregexp.cpp 8
+ \snippet code/src_corelib_text_qregexp.cpp 8
Here we've passed the QRegExp to QString's replace() function to
replace the matched text with new text.
- \snippet code/src_corelib_tools_qregexp.cpp 9
+ \snippet code/src_corelib_text_qregexp.cpp 9
We've used the indexIn() function to repeatedly match the regexp in
the string. Note that instead of moving forward by one character
@@ -655,7 +655,7 @@ QT_BEGIN_NAMESPACE
One common use of regexps is to split lines of delimited data into
their component fields.
- \snippet code/src_corelib_tools_qregexp.cpp 10
+ \snippet code/src_corelib_text_qregexp.cpp 10
In this example our input lines have the format company name, web
address and country. Unfortunately the regexp is rather long and
@@ -665,13 +665,13 @@ QT_BEGIN_NAMESPACE
QString::split() function can take a separator string or regexp
as an argument and split a string accordingly.
- \snippet code/src_corelib_tools_qregexp.cpp 11
+ \snippet code/src_corelib_text_qregexp.cpp 11
Here field[0] is the company, field[1] the web address and so on.
To imitate the matching of a shell we can use wildcard mode.
- \snippet code/src_corelib_tools_qregexp.cpp 12
+ \snippet code/src_corelib_text_qregexp.cpp 12
Wildcard matching can be convenient because of its simplicity, but
any wildcard regexp can be defined using full regexps, e.g.
@@ -766,7 +766,7 @@ QT_BEGIN_NAMESPACE
exactly, you can wrap the pattern using the QRegularExpression::anchoredPattern()
function:
- \snippet code/src_corelib_tools_qregexp.cpp 21
+ \snippet code/src_corelib_text_qregexp.cpp 21
\section3 Porting from QRegExp's Partial Matching
@@ -4417,7 +4417,7 @@ QT_WARNING_POP
QString::replace().
Example:
- \snippet code/src_corelib_tools_qregexp.cpp 13
+ \snippet code/src_corelib_text_qregexp.cpp 13
Although const, this function sets matchedLength(),
capturedTexts() and pos().
@@ -4803,17 +4803,17 @@ int QRegExp::captureCount() const
(capturing) subexpression of the regexp.
For example:
- \snippet code/src_corelib_tools_qregexp.cpp 14
+ \snippet code/src_corelib_text_qregexp.cpp 14
The above example also captures elements that may be present but
which we have no interest in. This problem can be solved by using
non-capturing parentheses:
- \snippet code/src_corelib_tools_qregexp.cpp 15
+ \snippet code/src_corelib_text_qregexp.cpp 15
Note that if you want to iterate over the list, you should iterate
over a copy, e.g.
- \snippet code/src_corelib_tools_qregexp.cpp 16
+ \snippet code/src_corelib_text_qregexp.cpp 16
Some regexps can match an indeterminate number of times. For
example if the input string is "Offsets: 12 14 99 231 7" and the
@@ -4866,7 +4866,7 @@ QStringList QRegExp::capturedTexts()
match has index 0 and the parenthesized subexpressions have
indexes starting from 1 (excluding non-capturing parentheses).
- \snippet code/src_corelib_tools_qregexp.cpp 17
+ \snippet code/src_corelib_text_qregexp.cpp 17
The order of elements matched by cap() is as follows. The first
element, cap(0), is the entire matching string. Each subsequent
@@ -4895,7 +4895,7 @@ QString QRegExp::cap(int nth)
of the whole match.
Example:
- \snippet code/src_corelib_tools_qregexp.cpp 18
+ \snippet code/src_corelib_text_qregexp.cpp 18
For zero-length matches, pos() always returns -1. (For example, if
cap(4) would return an empty string, pos(4) returns -1.) This is
@@ -4951,11 +4951,11 @@ QString QRegExp::errorString()
Example:
- \snippet code/src_corelib_tools_qregexp.cpp 19
+ \snippet code/src_corelib_text_qregexp.cpp 19
This function is useful to construct regexp patterns dynamically:
- \snippet code/src_corelib_tools_qregexp.cpp 20
+ \snippet code/src_corelib_text_qregexp.cpp 20
\sa setPatternSyntax()
*/