| Line 10... |
Line 10... |
| 10 |
\arguments{
|
10 |
\arguments{
|
| 11 |
\item{x}{a character vector.}
|
11 |
\item{x}{a character vector.}
|
| 12 |
\item{delim}{a character vector of length 2 giving the start and end
|
12 |
\item{delim}{a character vector of length 2 giving the start and end
|
| 13 |
delimiters. Currently, both must be single characters. Future
|
13 |
delimiters. Currently, both must be single characters. Future
|
| 14 |
versions might allow for arbitrary regular expressions.}
|
14 |
versions might allow for arbitrary regular expressions.}
|
| 15 |
\item{syntax}{currently, always the string \code{"Rd"} indicating Rd
|
15 |
\item{syntax}{currently, always the string \samp{"Rd"} indicating Rd
|
| 16 |
syntax (i.e., \code{\%} starts a comment extending till the end of
|
16 |
syntax (i.e., \samp{\%} starts a comment extending till the end of
|
| 17 |
the line, and \code{\\} escapes). Future versions might know about
|
17 |
the line, and \samp{\\} escapes). Future versions might know about
|
| 18 |
other syntaxes, perhaps via ``syntax tables'' allowing to flexibly
|
18 |
other syntaxes, perhaps via \dQuote{syntax tables} allowing to
|
| 19 |
specify comment, escape, and quote characters.}
|
19 |
flexibly specify comment, escape, and quote characters.}
|
| 20 |
}
|
20 |
}
|
| 21 |
\value{
|
21 |
\value{
|
| 22 |
An integer vector of the same length as \code{x} giving the starting
|
22 |
An integer vector of the same length as \code{x} giving the starting
|
| 23 |
position of the first match, or \eqn{-1} if there is none, with
|
23 |
position of the first match, or \eqn{-1} if there is none, with
|
| 24 |
attribute \code{"match.length"} giving the length of the matched text
|
24 |
attribute \code{"match.length"} giving the length of the matched text
|
| 25 |
(or \eqn{-1} for no match).
|
25 |
(or \eqn{-1} for no match).
|
| 26 |
}
|
26 |
}
|
| 27 |
\seealso{
|
27 |
\seealso{
|
| 28 |
\code{\link{regexpr}} for ``simple'' pattern matching.
|
28 |
\code{\link{regexpr}} for \dQuote{simple} pattern matching.
|
| 29 |
}
|
29 |
}
|
| 30 |
\examples{
|
30 |
\examples{
|
| 31 |
x <- c("\value\{foo\}", "function(bar)")
|
31 |
x <- c("\value\{foo\}", "function(bar)")
|
| 32 |
delimMatch(x)
|
32 |
delimMatch(x)
|
| 33 |
delimMatch(x, c("(", ")"))
|
33 |
delimMatch(x, c("(", ")"))
|