libkdepim
KRegExp3 Class Reference
#include <kregexp3.h>
Detailed Description
A QRegExp (Qt3.x) with a replace() method.This class is simply there to provide a namespace for some nice enhancements of the mighty QRegExp (Qt3 version) regular expression engine, namely the method replace(), which can be used to do search-and-replace like one is used to from perl or sed.
It "simply" adds the ability to define a replacement string which contains references to the captured substrings. The following constructs are understood, which can be freely mixed in the replacement string:
syntax
Back references in the replacement string are made using(backslash-digit), where
n
is a single digit. With this mode of operation, only the first nine captured substrings can be referenced.NOTE: Remember that C++ interprets the backslash in string constants, so you have to write a backslash as "\\".
syntax
Back references in the replacement string are made using $n (dollarsign-digit), wheren
is a single digit. With this mode of operation, only the first nine captured substrings can be referenced.
Additionally, Perl supports the syntax ${nn} (dollarSign-leftCurlyBrace-digits-rightCurlyBrace), where nn
can be a multi-digit number.
In all modes, counting of captured substrings starts with 1 (one)! To reference the entire matched string, use $0, ${0} or \0.
- Author:
- Marc Mutz <mutz@kde.org>
- See also:
- QRegExp
Definition at line 79 of file kregexp3.h.
Public Member Functions | |
KRegExp3 (const QString &pattern, bool caseSensitive=TRUE, bool wildcard=FALSE) | |
KRegExp3 (const QRegExp &rx) | |
KRegExp3 (const KRegExp3 &rx) | |
QString | replace (const QString &str, const QString &replacementStr, int start=0, bool global=TRUE) |
Member Function Documentation
|
Replaces each matching subpattern in
Definition at line 40 of file kregexp3.cpp. |
The documentation for this class was generated from the following files: