Test Regular Expression Validity

Share:

Description

Test regular expression validity of a regexr object.

Usage

1
test(x, quiet, ...)

Arguments

x

A regexr object.

quiet

logical. Should test print warnings about the concatenated expression and individual sub-expressions?

...

Ignored.

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 sub-expressions that makes up the concatenated expression.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
m <- construct(
    space =
        "\\s+"
            %:)%"I see",

    simp =
        "(?<=(foo))",

    or =
        "(;|:)\\s*"
            %:)%"comment on what this does",

    "[a]s th[atey]"
)


test(m)
## Not run: 
subs(m)[5:7] <- c("(", "([A-Z]|(\\d{5})", ")")
test(m)

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.