📄 qregexp.3qt
字号:
.TH QRegExp 3qt "6 July 1999" "Troll Tech AS" \" -*- nroff -*-.\" Copyright 1992-1999 Troll Tech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQRegExp \- Pattern matching using regular expressions or wildcards.SH SYNOPSIS.br.PP\fC#include <qregexp.h>\fR.PP.SS "Public Members".in +1c.ti -1c.BI "\fBQRegExp\fR ()".br.ti -1c.BI "\fBQRegExp\fR ( const QString &, bool " "caseSensitive" "=TRUE, bool " "wildcard" "=FALSE )".br.ti -1c.BI "\fBQRegExp\fR ( const QRegExp & )".br.ti -1c.BI "\fB~QRegExp\fR ()".br.ti -1c.BI "QRegExp& \fBoperator=\fR ( const QRegExp & )".br.ti -1c.BI "QRegExp& \fBoperator=\fR ( const QString & pattern )".br.ti -1c.BI "bool \fBoperator==\fR ( const QRegExp & ) const".br.ti -1c.BI "bool \fBoperator!=\fR ( const QRegExp & r ) const".br.ti -1c.BI "bool \fBisEmpty\fR () const".br.ti -1c.BI "bool \fBisValid\fR () const".br.ti -1c.BI "bool \fBcaseSensitive\fR () const".br.ti -1c.BI "void \fBsetCaseSensitive\fR ( bool )".br.ti -1c.BI "bool \fBwildcard\fR () const".br.ti -1c.BI "void \fBsetWildcard\fR ( bool )".br.ti -1c.BI "QString \fBpattern\fR () const".br.ti -1c.BI "int \fBmatch\fR ( const QString & " "str" ", int " "index" "=0, int * " "len" "=0, bool " "indexIsStart" " = TRUE ) const".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "void \fBcompile\fR ()".br.ti -1c.BI "const QChar* \fBmatchstr\fR ( uint *, const QChar *, uint, const QChar * ) const".br.in -1c.SH DESCRIPTIONThe QRegExp class provides pattern matching using regular expressions or wildcards..PPQRegExp knows these regexp primitives:.TP\fIc\fR matches the character 'c'.TP\fI.\fR matches any character.TP\fI^\fR matches start of input (except [^x] which matches NOT [x]).TP\fI$\fR matches end of input.TP\fI[]\fR matches a set of characters, for example [a-z0-9_].TP\fIa*\fR matches a sequence of zero or more a's.TP\fIa+\fR matches a sequence of one or more a's.TP\fIa?\fR matches an optional a.TP\fI\\c\fR escape code for matching special characters like \\, [, *, +, . etc..TP\fI\\b\fR matches the BELL character (7).TP\fI\\t\fR matches the TAB character (9).TP\fI\\n\fR matches newline (10).TP\fI\\r\fR matches return (13).TP\fI\\s\fR matches white space (defined as any character where QChar::isSpace() returns TRUE. This includes ASCII characters 9 (TAB), 10 (LF), 11 (VT), 12(FF), 13 (CR), and 32 (Space))..TP\fI\\x12\fR matches the character 0x12 (18 decimal, 12 hexadecimal)..TP\fI\\022\fR matches the character 022 (18 decimal, 22 octal)..PPIn wildcard mode, it only knows four primitives:.TP\fIc\fR matches the character 'c'.TP\fI?\fR matches any character.TP\fI*\fR matches any sequence of characters.TP\fI[]\fR matches a defined set of characters, e.g. [a-zA-Z0-9\\.] matches upper and lower case ASCII letters, digits, and dot, and [^z] matches everything except lower-case z..PPQRegExp supports Unicode both in the pattern strings and in the strings to be matched..PPWhen writing regular expressions in C++ code, remember that the C++ preprocessor processes \\ characters. So in order to match e.g. a "." character, you must write "\\\\." in C++ source, not "\\."..PPBugs and limitations:.TPCase insensitive matching is not supported for non-ASCII (non-8bit) characters. Any charcter with a non-zero QChar.row() is matched case sensitively even if the QRegExp is in case insensitive mode..PPExamples:.(lqmag/qmag.cpp.)l.SH MEMBER FUNCTION DOCUMENTATION.SH "QRegExp::QRegExp ()"Constructs an empty regular expression..SH "QRegExp::QRegExp ( const QString & pattern, bool caseSensitive=TRUE, bool wildcard=FALSE )"Constructs a regular expression..PPArguments:.TP\fIpattern\fR is the regular expression pattern string..TP\fIcaseSensitive\fR specifies whether or not to use case sensitive matching..TP\fIwildcard\fR specifies whether the pattern string should be used for wildcard matching (also called globbing expression), normally used for matching file names..PPSee also: setWildcard()..SH "QRegExp::QRegExp ( const QRegExp & r )"Constructs a regular expression which is a copy of \fIr.\fR.PPSee also: operator=(const and QRegExp&)..SH "QRegExp::~QRegExp ()"Destroys the regular expression and cleans up its internal data..SH "bool QRegExp::caseSensitive () const"Returns TRUE if case sensitivity is enabled, otherwise FALSE. The default is TRUE..PPSee also: setCaseSensitive()..SH "void QRegExp::compile () \fC[protected]\fR"For internal use only..SH "bool QRegExp::isEmpty () const"Returns TRUE if the regexp is empty..SH "bool QRegExp::isValid () const"Returns TRUE if the regexp is valid, or FALSE if it is invalid..PPThe pattern "[a-z" is an example of an invalid pattern, since it lacks a closing bracket..SH "int QRegExp::match ( const QString & str, int index=0, int * len=0, bool indexIsStart = TRUE ) const"Attempts to match in \fIstr,\fR starting from position \fIindex.\fR Returns the position of the match, or -1 if there was no match..PPIf \fIlen\fR is not a null pointer, the length of the match is stored in \fI*len.\fR.PPIf \fIindexIsStart\fR is TRUE (the default), the position \fIindex\fR in the string will match the start-of-input primitive (^) in the regexp, if present. Otherwise, position 0 in \fIstr\fR will match..PPExample:.PP.nf.br QRegExp r("[0-9]*\\\\.[0-9]+"); // matches floating point.br int len;.br r.match("pi = 3.1416", 0, &len); // returns 5, len == 6.fi.PPExamples:.(lqmag/qmag.cpp.)l.SH "const QChar * QRegExp::matchstr ( uint * rxd, const QChar * str, uint strlength, const QChar * bol ) const \fC[protected]\fR"For internal use only..SH "bool QRegExp::operator!= ( const QRegExp & r ) const"Returns TRUE if this regexp is \fInot\fR equal to \fIr.\fR.PPSee also: operator==()..SH "QRegExp & QRegExp::operator= ( const QString & pattern )"Sets the pattern string to \fIpattern\fR and returns a reference to this regexp. The case sensitivity or wildcard options do not change..SH "QRegExp & QRegExp::operator= ( const QRegExp & r )"Copies the regexp \fIr\fR and returns a reference to this regexp. The case sensitivity and wildcard options are copied, as well..SH "bool QRegExp::operator== ( const QRegExp & r ) const"Returns TRUE if this regexp is equal to \fIr.\fR.PPTwo regexp objects are equal if they have equal pattern strings, case sensitivity options and wildcard options..SH "QString QRegExp::pattern () const"Returns the pattern string of the regexp..SH "void QRegExp::setCaseSensitive ( bool enable )"Enables or disables case sensitive matching..PPIn case sensitive mode, "a.e" matches "axe" but not "Axe"..PPSee also: caseSensitive()..SH "void QRegExp::setWildcard ( bool wildcard )"Sets the wildcard option for the regular expression. The default is FALSE..PPSetting \fIwildcard\fR to TRUE makes it convenient to match filenames instead of plain text..PPFor example, "qr*.cpp" matches the string "qregexp.cpp" in wildcard mode, but not "qicpp" (which will be matched in normal mode)..PPSee also: wildcard()..SH "bool QRegExp::wildcard () const"Returns TRUE if wildcard mode is on, otherwise FALSE..PPSee also: setWildcard()..SH "SEE ALSO".BR http://www.troll.no/qt/qregexp.html.SH COPYRIGHTCopyright 1992-1999 Troll Tech AS. See the license file included inthe distribution for a complete license statement..SH AUTHORGenerated automatically from the source code.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -