Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

Backreferences

Backreferences


Description

Backreferences for replacement operations. These are used by replacement functions such as sub and stri_replace_first_regex, and by the stringi and stringr match functions such as stri_match_first_regex.

Usage

REF1

REF2

REF3

REF4

REF5

REF6

REF7

REF8

REF9

ICU_REF1

ICU_REF2

ICU_REF3

ICU_REF4

ICU_REF5

ICU_REF6

ICU_REF7

ICU_REF8

ICU_REF9

Format

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

References

See Also

capture, for creating capture groups that can be referred to.

Examples

# For R's PCRE and Perl engines
REF1
REF2
# and so on, up to
REF9

# For stringi/stringr's ICU engine
ICU_REF1
ICU_REF2
# and so on, up to
ICU_REF9

# Usage
sub("a(b)c(d)", REF1 %R% REF2, "abcd")
stringi::stri_replace_first_regex("abcd", "a(b)c(d)", ICU_REF1 %R% ICU_REF2)

rebus.base

Core Functionality for the 'rebus' Package

v0.0-3
Unlimited
Authors
Richard Cotton [aut, cre]
Initial release
2017-04-25

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.