Learn R Programming

regexr (version 1.1.0)

subs: Get/Set Regex Sub-expressions From a regexr Object

Description

subs - Get the sub-expressions from a regexr object.

subs<- - Set the sub-expressions(s) of a regexr object.

set_subs - This is a convenience function that sets the subs on a regexr object and returns the object.

Usage

subs(x, ...)
subs(x) <- value
set_subs(x, y)

Arguments

x
A regexr object.
value
The comment(s) to assign.
y
The sub-expressions to assign.
...
Ignored.

Value

subs - Returns a list of sub-expressions.set_subs - Returns a regexr object.

Examples

Run this code
minimal <- construct("a", "b", "c")
minimal
subs(minimal)
subs(minimal)[2] <- "\\s+[A-Z]|[0-9]"
subs(minimal)

minimal <- construct("a", "b", "c")
out <- set_subs(minimal, c("(", "\\s??", ")"))
subs(out)

Run the code above in your browser using DataLab