char_class: A range or char_class of characters

Description Usage Arguments Value References Examples

View source: R/grouping-and-repetition.R

Description

Group characters together in a class to match any of them (char_class) or none of them (negated_char_class).

Usage

1
2
3
4
5

Arguments

...

Character vectors.

Value

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

References

http://www.regular-expressions.info/charclass.html

Examples

1
2
3
4
5
6
7
8
9
char_class(LOWER, "._")
negated_char_class(LOWER, "._")

# Usage
x <- (1:10) ^ 2
(rx_odd <- char_class(1, 3, 5, 7, 9))
(rx_not_odd <- negated_char_class(1, 3, 5, 7, 9))
stringi::stri_detect_regex(x, rx_odd)
stringi::stri_detect_regex(x, rx_not_odd)

Example output

<regex> [[:lower:]._]
<regex> [^[:lower:]._]
<regex> [13579]
<regex> [^13579]
 [1]  TRUE FALSE  TRUE  TRUE  TRUE  TRUE  TRUE FALSE  TRUE  TRUE
 [1] FALSE  TRUE FALSE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE

rebus.base documentation built on May 29, 2017, 6:13 p.m.