| Line 36... |
Line 36... |
| 36 |
\item{value}{if \code{FALSE}, a vector containing the (\code{integer})
|
36 |
\item{value}{if \code{FALSE}, a vector containing the (\code{integer})
|
| 37 |
indices of the matches determined by \code{grep} is returned, and if
|
37 |
indices of the matches determined by \code{grep} is returned, and if
|
| 38 |
\code{TRUE}, a vector containing the matching elements themselves is
|
38 |
\code{TRUE}, a vector containing the matching elements themselves is
|
| 39 |
returned.}
|
39 |
returned.}
|
| 40 |
\item{fixed}{logical. If \code{TRUE}, \code{pattern} is a string to be
|
40 |
\item{fixed}{logical. If \code{TRUE}, \code{pattern} is a string to be
|
| 41 |
matched as is. Overrides all other arguments.}
|
41 |
matched as is. Overrides all other arguments.}
|
| 42 |
\item{replacement}{a replacement for matched pattern in \code{sub} and
|
42 |
\item{replacement}{a replacement for matched pattern in \code{sub} and
|
| 43 |
\code{gsub}.}
|
43 |
\code{gsub}.}
|
| 44 |
}
|
44 |
}
|
| 45 |
\details{
|
45 |
\details{
|
| 46 |
Arguments which should be character strings or character vectors are
|
46 |
Arguments which should be character strings or character vectors are
|
| 47 |
coerced to character if possible.
|
47 |
coerced to character if possible.
|
| 48 |
|
48 |
|
| 49 |
The two \code{*sub} functions differ only in that \code{sub} replaces
|
49 |
The two \code{*sub} functions differ only in that \code{sub} replaces
|
| 50 |
only the first occurrence of a \code{pattern} whereas \code{gsub}
|
50 |
only the first occurrence of a \code{pattern} whereas \code{gsub}
|
| 51 |
replaces all occurrences.
|
51 |
replaces all occurrences.
|
| 52 |
|
52 |
|
| 53 |
For \code{regexpr} it is an error for \code{pattern} to be \code{NA},
|
53 |
For \code{regexpr} it is an error for \code{pattern} to be \code{NA},
|
| Line 78... |
Line 78... |
| 78 |
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)
|
78 |
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)
|
| 79 |
\emph{The New S Language}.
|
79 |
\emph{The New S Language}.
|
| 80 |
Wadsworth \& Brooks/Cole (\code{grep})
|
80 |
Wadsworth \& Brooks/Cole (\code{grep})
|
| 81 |
}
|
81 |
}
|
| 82 |
\seealso{
|
82 |
\seealso{
|
| 83 |
\link{regular expression} for the details of the pattern specification.
|
83 |
\link{regular expression} (aka \code{\link{regexp}}) for the details
|
| - |
|
84 |
% the `aka' above is for ESS (and ?reg....) where a space is problematic
|
| - |
|
85 |
of the pattern specification.
|
| 84 |
|
86 |
|
| 85 |
\code{\link{agrep}} for approximate matching.
|
87 |
\code{\link{agrep}} for approximate matching.
|
| 86 |
|
88 |
|
| 87 |
\code{\link{tolower}}, \code{\link{toupper}} and \code{\link{chartr}}
|
89 |
\code{\link{tolower}}, \code{\link{toupper}} and \code{\link{chartr}}
|
| 88 |
for character translations.
|
90 |
for character translations.
|
| 89 |
\code{\link{charmatch}}, \code{\link{pmatch}}, \code{\link{match}}.
|
91 |
\code{\link{charmatch}}, \code{\link{pmatch}}, \code{\link{match}}.
|
| 90 |
\code{\link[utils]{apropos}} uses regexps and has nice examples.
|
92 |
\code{\link[utils]{apropos}} uses regexps and has nice examples.
|
| 91 |
}
|
93 |
}
|