oldGrep(pattern, text)
text
matched
pattern
.
It returns
numeric(0)
when there are no matches.
In all cases, the return value can be
used as a subscript to retrieve the matching elements of
text
.
This function provides access to an old version of the
grep
function, which interprets
pattern
differently on different platforms.
The current
grep
function is exactly the
same on all platforms, and is the preferred version to use.
This function interprets
pattern
almost the same as
grep
and
regexpr
, except that it allows
pattern
to be a vector of character strings,
or to contain the "|" character to indicate multiple patterns.
state.name[ oldGrep("ia$", state.name) ] # find state names that end in "ia" state.name[ oldGrep("ia$|^M", state.name) ] # find state names that end in "ia" or start with "M" # Note matching is not the same as in ls state.name [oldGrep ("^Ne", state.name)] # returns all states beginning with "Ne" state.name [oldGrep ("Ne[a-e]", state.name)] # returns Nebraska