test(x, quiet, ...)
regexr
object.test
print warnings about the
concatenated expression and individual chunks?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.
Test regular expression validity of a regexr
object.
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 TRUEregex(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