Matches a space character.

rx_space(.data = NULL, inverse = FALSE)

Arguments

.data

Expression to append, typically pulled from the pipe %>%

inverse

Invert match behavior, defaults to FALSE (match space). Use TRUE to not match space.

Examples

# match space, default rx_space()
#> [1] " "
# dont match space rx_space(inverse = TRUE)
#> [1] "[^ ]"
# create an expression x <- rx_space() # create input string <- "1 apple\t" # extract match regmatches(string, regexpr(x, string))
#> [1] " "
# extract no whitespace by inverting behavior y <- rx_space(inverse = TRUE) regmatches(string, gregexpr(y, string))
#> [[1]] #> [1] "1" "a" "p" "p" "l" "e" "\t" #>