Test Regular Expression Validity

Usage

test(x, quiet, ...)

Arguments

x
A regexr object.
quiet
logical. Should test print warnings about the concatenated expression and individual chunks?
...
Ignored.

Test Regular Expression Validity

Value

Returns a list of two logical vectors. The first vector is a test of the concatenated expression. The second vector is a logical test of the validity of each regular expression chunk that makes up the concatenated expression.

Description

Test regular expression validity of a regexr object.

Examples

m <- construct( space = "\\s+" %:)%"I see", simp = "(?<=(foo))", or = "(;|:)\\s*" %:)%"comment on what this does", "[a]s th[atey]" ) test(m)
$regex [1] TRUE $chunks space simp or TRUE TRUE TRUE TRUE
regex(m)[5:7] <- c("(", "([A-Z]|(\\d{5})", ")") test(m)
Warning message: The concatenated regex is not valid \s+(?<=(foo))(;|:)\s*[a]s th[atey](([A-Z]|(\d{5})) Warning message: The following regex chunks are not valid in isolation: (1) ( (2) ([A-Z]|(\d{5}) (3) )
$regex [1] FALSE $chunks space simp or TRUE TRUE TRUE TRUE FALSE FALSE FALSE