regMatch(x, table, extended=x)
"extended"
regular expressions be used, default =
T
.
See note below.
x
has
NA
s these produce
NA
in the result.
If
x
and
table
are not the same length,
the shorter one is extended by replication.
These are character strings in a little language with meta-characters
to match position in the string or classes of characters.
See your local documentation for the shell command
"grep"
or any book on UNIX.
The
extended
patterns allow some additional control.
S-PLUS does not invoke any shell commands to process the matching;
instead, the matching is done internally by calls to routines
implementing the Posix standard definition of regular expressions.
table
.
# find state names starting in "New" newStates <- regMatch(state.name, "^New ")