as.regexr: Generic Method to Coerce to regexr

Description Usage Arguments Value Note Examples

Description

Coerce an object to regexr class.

Usage

1
2
as.regexr(x, names = TRUE, comments = TRUE, names.above = FALSE,
  comments.below = FALSE, ...)

Arguments

x

An object to coerce to a regexr object.

names

logical. Should names be included in the construct script?

comments

logical. Should comments be included in the construct script?

names.above

logical. Should ames be included above the regex in the construct script? If FALSE names are placed in front of the sub-expressions.

comments.below

logical. Should comments be included below the sub-expressions in the construct script? If FALSE comments are placed behind the sub-expressions.

...

Other arguments passed to as.regexr methods.

Value

Returns a dual regexr and reverse_construct object.

Note

as.regexr.character utilizes http://rick.measham.id.au/paste/explain to break the regular expression into sub-expressions.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
library("qdapRegex")
(myregex <- grab("@rm_time2"))
out <- as.regexr(myregex)

out
summary(out)
comments(out)
subs(out)
test(out)
get_construct(out)

## Not run: 
## On Windows copy to clipboard
get_construct(out, file="clipboard")

## End(Not run)

## No names & comments behind sub-expressions
myregex2 <- "(\\s*[a-z]+)([^)]+\\))"
get_construct(as.regexr(myregex2, names=FALSE))
get_construct(as.regexr(myregex2, names=FALSE, names.above = TRUE,
    comments.below = TRUE))

trinker/regexr documentation built on May 31, 2019, 9:50 p.m.