summaryrefslogtreecommitdiff
path: root/help/en/html/help/qregexp.html
blob: f2dc0a3a617d0f0bb1896de537dba4a3eb8c644f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<html><head><title>Pattern Matching</title></head><body>
<h1>Pattern Matching</h1>
Opie provides pattern matching using
<a href="#regexp">regular expressions</a>
or <a href="#wildcards">wildcards</a>.<br>
It supports <a href="#general">unicode</a> and
<a href="#general">character sets</a>.
<p>
<h2><a name="regexp"></a>Regular Expressions</h2>
Regular Expressions knows these primitives:
<ul plain>
<li><dfn>c</dfn> matches the character 'c'
<li><dfn>.</dfn> matches any character
<li><dfn>^</dfn> matches start of input
<li><dfn>$</dfn>  matches end of input
<li><dfn>[]</dfn> matches a defined set of characters - see below.
<li><dfn>a*</dfn> matches a sequence of zero or more a's
<li><dfn>a+</dfn> matches a sequence of one or more a's
<li><dfn>a?</dfn> matches an optional a
<li><dfn>\c</dfn> escape code for matching special characters such
as \, [, *, +, . etc.
<li><dfn>\t</dfn> matches the TAB character (9)
<li><dfn>\n</dfn> matches newline (10)
<li><dfn>\r</dfn> matches return (13)
<li><dfn>\s</dfn> matches a white space (defined as any character
for which QChar::isSpace() returns TRUE. This includes at least
ASCII characters 9 (TAB), 10 (LF), 11 (VT), 12(FF), 13 (CR) and 32
(Space)).
<li><dfn>\d</dfn> matches a digit (defined as any character for
which QChar::isDigit() returns TRUE. This includes at least ASCII
characters '0'-'9').
<li><dfn>\x1f6b</dfn> matches the character with unicode point U1f6b
(hexadecimal 1f6b). \x0012 will match the ASCII/Latin1 character
0x12 (18 decimal, 12 hexadecimal).
<li><dfn>\022</dfn> matches the ASCII/Latin1 character 022 (18
decimal, 22 octal).
</ul>
<h2><a name="wildcards"></a>wildcard mode</h2>
<p>In wildcard mode, it only knows four primitives:
<ul plain>
<li><dfn>c</dfn> matches the character 'c'
<li><dfn>?</dfn> matches any character
<li><dfn>*</dfn> matches any sequence of characters
<li><dfn>[]</dfn> matches a defined set of characters - see below.
</ul>
<h2><a name="general">General</a></h2>
<p>It supports Unicode both in the pattern strings and in the
strings to be matched.
<p>A character set matches a defined set of characters. For example,
[BSD] matches any of 'B', 'D' and 'S'. Within a character set, the
special characters '.', '*', '?', '^', '$', '+' and '[' lose their
special meanings. The following special characters apply:
<ul plain>
<li><dfn>^</dfn> When placed first in the list, changes the
character set to match any character <em>not</em> in the list. To include
the character '^' itself in the set, escape it or place it anywhere
but first.
<li><dfn>-</dfn> Defines a range of characters. To include the
character '-' itself in the set, escape it or place it last.
<li><dfn>]</dfn> Ends the character set definition. To include the
character ']' itself in the set, escape it or place it first (but
after the negation operator '^', if present)
</ul>
Thus, [a-zA-Z0-9.] matches upper and lower case ASCII letters,
digits and dot; and [^\s] matches everything except white space.
<p>Bugs and limitations:
<ul>
<li>Case insensitive matching is not supported for non-ASCII/Latin1
(non-8bit) characters.
</ul>
 <br><br>
 Taken from the Qt Documentation.<br>
 This file is part of the Qt toolkit,
 copyright © 1995-2001 Trolltech, all rights reserved.
</body></html>