rx_punctuation: Match punctuation characters.

View source: R/special_characters.R

rx_punctuationR Documentation

Match punctuation characters.

Description

Matches punctuation characters only: ! \" # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~.

Usage

rx_punctuation(.data = NULL, inverse = FALSE)

Arguments

.data

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

inverse

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

Examples

rx_punctuation()
rx_punctuation(inverse = TRUE)

# create an expression
x <- rx_punctuation()

# create input
string <- 'Apple 1!'

# extract match
regmatches(string, gregexpr(x, string))

# dont extract punctuation
y <- rx_punctuation(inverse = TRUE)
regmatches(string, gregexpr(y, string))

VerbalExpressions/RVerbalExpressions documentation built on March 27, 2024, 8:20 a.m.