as.regexr: Generic Method to Coerce to regexr

Description Usage Arguments Value Note Examples

View source: R/as.regexr.R

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 not currently supported as it utilized 'http://rick.measham.id.au/paste/explain', however this website appears not to be operational. This functionality may return if the website is again available or if a suitable replacement regex parser is found.

If you have a suggested web based parser please make a suggestion via: https://github.com/trinker/regexr/issues.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## Not run: 
## NOTE: These examples will likely fail unless
## http://rick.measham.id.au/paste/explain becomes available again.
library("qdapRegex")
(myregex <- grab("@rm_time2"))
out <- as.regexr(myregex)

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

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

## 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))

## End(Not run)

regexr documentation built on May 29, 2017, 5:57 p.m.