Learn R Programming

rebus.base (version 0.0-3)

Anchors: 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.

Value

A character vector representing part or all of a regular expression.

Format

An object of class regex (inherits from character) of length 1.

References

http://www.regular-expressions.info/anchors.html and http://www.rexegg.com/regex-anchors.html

See Also

whole_word and modify_mode

Examples

Run this code
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)

Run the code above in your browser using DataLab