KRegExp Class Reference
#include <kregexp.h>
Collaboration diagram for KRegExp:

Public Member Functions | |
KRegExp () | |
KRegExp (const char *_pattern, const char *_mode="") | |
bool | compile (const char *_pattern, const char *_mode="") |
bool | match (const char *_string) |
const char * | group (int _grp) |
int | groupStart (int _grp) |
int | groupEnd (int _grp) |
Detailed Description
- Deprecated:
- Please use QRegExp instead.
This was implemented because QRegExp did not support back-references. It now does and is recommended over KRegExp because of the unicode support and the more powerful API.
Back-references are parts of a regexp grouped with parentheses. If a string matches the regexp, you can access the text that matched each group with the group method. This is similar to regular expressions in Perl.
Example:
KRegExp ex( "([A-Za-z]+) (.+)" ); ex.match( "42 Torben Weis" ); kdDebug() << ex.group(0) << endl; kdDebug() << ex.group(1) << endl; kdDebug() << ex.group(2) << endl;
Torben Weis Torben Weis
Please notice that KRegExp does not support unicode.
- Author:
- Torben Weis <weis@kde.org>
- Version:
- Id
- kregexp.h,v 1.15 2003/08/30 07:42:36 raabe Exp
Definition at line 61 of file kregexp.h.
Constructor & Destructor Documentation
|
Creates a KRegExp object without a default pattern. Definition at line 143 of file kregexp.cpp. |
|
Creates a KRegExp object.
|
Member Function Documentation
|
Prepare a regular expression for subsequent matches.
References KRegExpPrivate::compile(). |
|
Match a string to the last supplied regexp.
References KRegExpPrivate::match(). |
|
Returns a group from the match.
References KRegExpPrivate::group(). |
|
The offset of the given group in the string.
References KRegExpPrivate::groupStart(). |
|
The offset of the given group's end in the string.
References KRegExpPrivate::groupEnd(). |
The documentation for this class was generated from the following files: