NAME
OTC_Regexp -
Class to perform egrep style pattern matching.
SYNOPSIS
#include <OTC/text/regexp.hh>
class OTC_Regexp : public OTC_Pattern
{
public:
static os_typespec* get_os_typespec();
~OTC_Regexp();
OTC_Regexp(char const* thePattern);
OTC_Boolean match(char const* theString);
u_int start() const;
u_int start(u_int theIndex) const;
u_int length() const;
u_int length(u_int theIndex) const;
inline OTC_Range range() const;
OTC_Range range(u_int theIndex) const;
OTC_Boolean isValid() const;
inline char const* error() const;
static OTC_Regexp& whiteSpace();
static OTC_Regexp& optWhiteSpace();
static OTC_Regexp& nonWhiteSpace();
static OTC_Regexp& integerValue();
static OTC_Regexp& realValue();
static OTC_Regexp& alphabetic();
static OTC_Regexp& lowerCase();
static OTC_Regexp& upperCase();
static OTC_Regexp& alphaNumeric();
static OTC_Regexp& identifier();
static OTC_Regexp& matchingQuotes();
static OTC_Regexp& quotedString();
protected:
void compile();
};
CLASS TYPE
Concrete
DESCRIPTION
Refer to the egrep(1) manual page for the format of
the pattern.
CONSTRUCTION
OTC_Regexp(char const* thePattern);
MATCHING
OTC_Boolean match(char const* theString);
Returns OTCLIB_TRUE if the pattern matched
against theString.
u_int start() const;
Returns the index of the first character
in the matched portion of the string.
u_int start(u_int theIndex) const;
Returns the index of the first character
in the tagged portion of the matched
string indicated by theIndex.
u_int length() const;
Returns the length of the matched portion
of the string.
u_int length(u_int theIndex) const;
Returns the length of the matched tagged
portion of the string indicated by
theIndex.
inline OTC_Range range() const;
Returns a range object for the matched
portion of the string.
OTC_Range range(u_int theIndex) const;
Returns a range object for the matched
tagged portion of the string indicated by
theIndex.
ERRORS
OTC_Boolean isValid() const;
Returns OTCLIB_TRUE if the pattern was
valid.
inline char const* error() const;
If the pattern was not valid, returns a
string describing the problem with the
pattern.
PATTERNS
Some commonly used regular expression are defined as constant
character strings. These are:
static OTC_Regexp& whiteSpace();
static OTC_Regexp& optWhiteSpace();
Optionally matches white space.
static OTC_Regexp& nonWhiteSpace();
static OTC_Regexp& integerValue();
static OTC_Regexp& realValue();
static OTC_Regexp& alphabetic();
Matches alpha characters.
static OTC_Regexp& lowerCase();
Matches lower case characters.
static OTC_Regexp& upperCase();
Matches upper case characters.
static OTC_Regexp& alphaNumeric();
Matches alphanumeric characters.
static OTC_Regexp& identifier();
static OTC_Regexp& matchingQuotes();
Matches string delineated with double
quotes. Doesn't handle \\" in
the string.
static OTC_Regexp& quotedString();
Matches string delineated with double
quotes. Handles \\" in string.
COMPILATION
void compile();
LIBRARY
OTC
AUTHOR(S)
Graham Dumpleton
COPYRIGHT
Copyright 1991 OTC LIMITED
Copyright 1994 DUMPLETON SOFTWARE CONSULTING PTY LIMITED