Tools.h++ Manual
21-70 104011 Tandem Computers Incorporated
21
Example
Public constructors
RWCRegexp(RWCS);
Construct a regular expression from the pattern given by
pat
. The status of
the results can be found by using member function
status()
.
RWCRegexp(const RWCRegexp& r);
Copy constructor. Uses value semantics—self will be a copy of
r
.
~RWCRegexp();
Destructor. Releases any allocated memory.
Assignment operators
RWCRegexp& operator=(const RWCRegexp&);
Uses value semantics—sets self to a copy of
r
.
RWCRegexp& operator=(const char* pat);
Recompiles self to the pattern given by
pat
. The status of the results can be
found by using member function
status()
.
#include <rw/regexp.h>
#include <rw/cstring.h>
#include <rw/rstream.h>
main()
{
RWCString aString("Hark! Hark! the lark");
// A regular expression matching any lower-case word
// starting with "l":
RWCRegexp reg("l[a-z]*");
cout << aString(reg) << endl; // Prints "lark"
}