Description Usage Format See Also Examples
Match a class of values. These are typically used in combination with
char_class
to create new character classes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
An object of class regex
(inherits from character
) of length 1.
ClassGroups
for the functional form,
SpecialCharacters
for regex metacharacters,
Anchors
for constants to match the start/end of a string,
WordBoundaries
for contants to match the start/end of a word.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | # R character classes
ALNUM
ALPHA
BLANK
CNTRL
DIGIT
GRAPH
LOWER
PRINT
PUNCT
SPACE
UPPER
HEX_DIGIT
# Special chars
ANY_CHAR
GRAPHEME
NEWLINE
# Generic classes
DGT
WRD
SPC
# Generic negated classes
NOT_DGT
NOT_WRD
NOT_SPC
# Non-locale-specific classes
ASCII_DIGIT
ASCII_LOWER
ASCII_UPPER
ASCII_ALPHA
ASCII_ALNUM
# An oxymoron
UNMATCHABLE
# Usage
x <- c("a1 A", "a1 a")
rx <- LOWER %R% DIGIT %R% SPACE %R% UPPER
stringi::stri_detect_regex(x, rx)
|
<regex> [:alnum:]
<regex> [:alpha:]
<regex> [:blank:]
<regex> [:cntrl:]
<regex> [:digit:]
<regex> [:graph:]
<regex> [:lower:]
<regex> [:print:]
<regex> [:punct:]
<regex> [:space:]
<regex> [:upper:]
<regex> [:xdigit:]
<regex> .
<regex> \X
<regex> \R
<regex> \d
<regex> \w
<regex> \s
<regex> \D
<regex> \W
<regex> \S
<regex> 0-9
<regex> a-z
<regex> A-Z
<regex> a-zA-Z
<regex> a-zA-Z0-9
<regex> $a
[1] TRUE FALSE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.