OWLNext 7.0
Borland's Object Windows Library for the modern age
|
This class represents regular expressions. More...
#include <owl/private/regexp.h>
Public Types | |
enum | StatVal { OK =0 , ILLEGAL , NOMEMORY , TOOLONG } |
StatVal enumerates the status conditions returned by TRegexp::status. More... | |
Public Member Functions | |
TRegexp (const tchar *cp) | |
TRegexp (const TRegexp &r) | |
~TRegexp () | |
TRegexp & | operator= (const TRegexp &r) |
TRegexp & | operator= (const tchar *cp) |
size_t | find (const tstring &s, size_t *len, size_t start=0) const |
StatVal | status () noexcept |
This class represents regular expressions.
TRegexp is a support class used by the string class for string searches. Regular expressions use these special characters:
General Rules
Characters other than the special characters match themselves. For example "yardbird" matches "yardbird". A backslash (\) followed by a special character, matches the special character itself. For example "Pardon\\?" matches "Pardon?". The following escape codes can be used to match control characters:
One-Character Regular Expressions
The ^ special character is used to specify search for any character but those specified. For example, "[ ^g-v ]" would match on any lowercase alphabetic character NOT between g and v.
Multiple-Character Regular Expressions
Regular expressions can be concatentated. For example, "[ A-Z ][ a-z ]*" matches capitalized words.
Matching at the Beginning and End of a Line If the ^ special character is at the beginning of a regular expression, then a match occurs only if the string is at the beginning of a line. For example, "^[ A-Z ][ a-z ]*" matches capitalized words at the beginning of a line. If the $ special character is at the end of a regular expression, the then a match occurs only if the string is at the end of a line. For example, "[ A-Z ][ a-z ]*$" matches capitalized words at the end of a line.
StatVal enumerates the status conditions returned by TRegexp::status.
Enumerator | |
---|---|
OK | Means the given regular expression is legal. |
ILLEGAL | Means the pattern was illegal. |
NOMEMORY | |
TOOLONG | Means the pattern exceeded maximum length (128) |
owl::TRegexp::TRegexp | ( | const tchar * | cp | ) |
Definition at line 29 of file regexp.cpp.
owl::TRegexp::TRegexp | ( | const TRegexp & | r | ) |
Definition at line 34 of file regexp.cpp.
owl::TRegexp::~TRegexp | ( | ) |
Definition at line 39 of file regexp.cpp.
Definition at line 86 of file regexp.cpp.
References owl::matchs(), OK, and PRECONDITION.
Definition at line 57 of file regexp.cpp.
Definition at line 64 of file regexp.cpp.
|
noexcept |
Definition at line 74 of file regexp.cpp.
References OK.