Anchors {rebus.base} | R Documentation |
The start or end of a string.
Description
START
matches the start of a string.
END
matches the end of a string.
exactly
makes the regular expression match the whole string, from
start to end.
Usage
START
END
exactly(x)
Arguments
x |
A character vector. |
Format
An object of class regex
(inherits from character
) of length 1.
Value
A character vector representing part or all of a regular expression.
Note
Caret and dollar are used as start/end delimiters, since \A
and
\Z
are not supported by R's internal PRCE engine or stringi
's
ICU engine.
References
http://www.regular-expressions.info/anchors.html and http://www.rexegg.com/regex-anchors.html
See Also
Examples
START
END
# Usage
x <- c("catfish", "tomcat", "cat")
(rx_start <- START %R% "cat")
(rx_end <- "cat" %R% END)
(rx_exact <- exactly("cat"))
stringi::stri_detect_regex(x, rx_start)
stringi::stri_detect_regex(x, rx_end)
stringi::stri_detect_regex(x, rx_exact)
[Package rebus.base version 0.0-3 Index]