Tools.h++ Class Reference

Table Of Contents
+ * ? . [ ] ^ $ ( ) { } | \
The period (.) matches any character. E.g., ".umpty" matches either "Humpty" or "Dumpty."3.
A set of characters enclosed in brackets ([ ]) is a one-character RE that matches any of the
characters in that set. E.g., "[akm]" matches either an "a", "k", or "m". A range of characters
can be indicated with a dash. E.g., "[a-z]" matches any lower-case letter. However, if the first
character of the set is the caret (^), then the RE matches any character except those in the set.
It does not match the empty string. Example: [^akm] matches any character except "a", "k",
or "m". The caret loses its special meaning if it is not the first character of the set. The
following rules can be used to build a multicharacter RE:
4.
Parentheses (( )) group parts of regular expressions together into subexpressions that can be
treated as a single unit. For example, (ha)+ matches one or more "ha"'s.
5.
A one-character RE followed by an asterisk (*) matches zero or more occurrences of the RE.
Hence, [a-z]* matches zero or more lower-case characters.
6.
A one-character RE followed by a plus (+) matches one or more occurrences of the RE.
Hence, [a-z]+ matches one or more lower-case characters.
7.
A question mark (?) is an optional element. The preceeding RE can occur zero or once in the
string -- no more. E.g. xy?z matches either xyz or xz.
8.
The concatenation of REs is a RE that matches the corresponding concatenation of strings.
E.g., [A-Z][a-z]* matches any capitalized word.
9.
The OR character ( | ) allows a choice between two regular expressions. For example,
jell(y|ies) matches either "jelly" or "jellies".
10.
Braces ({ }) are reserved for future use.11.
All or part of the regular expression can be "anchored" to either the beginning or end of the
string being searched:
12.
If the caret (^) is at the beginning of the (sub)expression, then the matched string must be at
the beginning of the string being searched.
13.
If the dollar sign ($) is at the end of the (sub)expression, then the matched string must be at
the end of the string being searched.
14.
Persistence
None
Example
#include <rw/re.h>
#include <rw/cstring.h>
#include <rw/rstream.h>