Skip to content

Commit

Permalink
version 1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jimhester authored and cran-robot committed Oct 19, 2017
1 parent 2f64211 commit f8d5cf1
Show file tree
Hide file tree
Showing 35 changed files with 220 additions and 331 deletions.
12 changes: 6 additions & 6 deletions DESCRIPTION
@@ -1,7 +1,7 @@
Package: rex
Type: Package
Title: Friendly Regular Expressions
Version: 1.1.1
Version: 1.1.2
Authors@R: c(
person("Kevin", "Ushey", email = "kevinushey@gmail.com", role = "aut"),
person("Jim", "Hester", email = "james.f.hester@gmail.com", role = c("aut", "cre")),
Expand All @@ -13,17 +13,17 @@ BugReports: https://github.com/kevinushey/rex/issues
Description: A friendly interface for the construction of regular expressions.
Imports: magrittr, lazyeval
License: MIT + file LICENSE
Suggests: testthat, knitr, rmarkdown, dplyr, ggplot2, lintr, Hmisc,
stringr, rvest, roxygen2
Suggests: testthat, knitr, rmarkdown, dplyr, ggplot2, Hmisc, stringr,
rvest, roxygen2, covr
VignetteBuilder: knitr
Collate: 'aaa.R' 'utils.R' 'escape.R' 'capture.R' 'character_class.R'
'counts.R' 'lookarounds.R' 'match.R' 'or.R' 'rex-mode.R'
'rex.R' 'shortcuts.R' 'wildcards.R' 'zzz.R'
RoxygenNote: 5.0.1.9000
RoxygenNote: 6.0.1.9000
NeedsCompilation: no
Packaged: 2016-03-10 22:45:34 UTC; jhester
Packaged: 2017-10-19 19:22:40 UTC; jhester
Author: Kevin Ushey [aut],
Jim Hester [aut, cre],
Robert Krzyzanowski [aut]
Repository: CRAN
Date/Publication: 2016-03-11 00:40:20
Date/Publication: 2017-10-19 19:54:00 UTC
68 changes: 34 additions & 34 deletions MD5
@@ -1,49 +1,49 @@
eeeecc5ad3944831cea55476527cb909 *DESCRIPTION
ab6ce331a57ff9cecc421f00088fb50a *DESCRIPTION
a066f78ea5d786ee1d559efc84241161 *LICENSE
2c3c07acca795e9bdec65b3398e64193 *NAMESPACE
489fd023890c068151298ec4da3b78b7 *NEWS.md
d8990f9388f6a1c96689f2cb2ae62728 *NAMESPACE
771f0fd16ce646696da13fd649307a30 *NEWS.md
5c321a12d9ecfa525ca2fb20725f3f17 *R/aaa.R
b780a775089dd88efcf67a0635a0058e *R/capture.R
39f4c60efe6d71c5b3eb3ec8d19f3873 *R/character_class.R
ac49ea725b7298bf9cbfb957341e215a *R/counts.R
a5c75daa0b7a85e6df7f1b023230af9c *R/escape.R
1a98058551b8a40171c53866993b54bc *R/lookarounds.R
c5a3f2ca934d9880c2be7d28a0167054 *R/match.R
ceb51d4dc8e4b7c4cd36d3a6cc6da0a8 *R/match.R
e0085ac9fb1905afeb5f6849e70c3eb3 *R/or.R
22e4556e954fd76e09fb434394514ac9 *R/rex-mode.R
af8424959eba0dbb865cef93ac56e6b7 *R/rex.R
a6345e1ede16ebad3955b322bda94034 *R/rex.R
7f338bfcf826a74fb4e32a5b553f8e99 *R/shortcuts.R
a765ae4fd76afb1326aed1ba61a80f38 *R/utils.R
ae5f05556325f5ab268341b2de50c377 *R/wildcards.R
eb0afc6c958bc758a3d79ae339230369 *R/zzz.R
c9824fc3eb98cc8afb85d56108f9952e *README.md
0d4ea5efd8ad459a865530c749cd3337 *build/vignette.rds
2a8f09407ffec5393bbecae844bf1f66 *inst/doc/log_parsing.R
467827fefadf7aa5ac9a86c640548ece *inst/doc/log_parsing.Rmd
f55fe8df7ebaaec4a08a1067ef88e3a4 *inst/doc/log_parsing.html
f29b1e09ce6f5c080d65faf0bc4fb4eb *inst/doc/url_parsing.R
f76c48576b774db2a369bdd17de81ef3 *inst/doc/url_parsing.Rmd
a8819428c011eb40d638dee5b02bb6e3 *inst/doc/url_parsing.html
6d1a21e401ddc02f332804b7c556a0ea *README.md
95788e21ded42a114a01d96383d0c944 *build/vignette.rds
57c2c6e5917b7196905f8c1aa6a1075e *inst/doc/log_parsing.R
856eae22b696240b244ce83e9796f0fb *inst/doc/log_parsing.Rmd
dd4c73b550f222d64cd9f08432d943cf *inst/doc/log_parsing.html
7f84ce21bd0d9c880373263ca3f93523 *inst/doc/url_parsing.R
148cd376374385379c63ae6c70161638 *inst/doc/url_parsing.Rmd
cb58820e8e8a847d5b21146942959bee *inst/doc/url_parsing.html
ecf7fa080f23298c2d3e7cef8c603da2 *man/as.regex.Rd
5e9edd376f2e3f59164f23bf68b52c3a *man/capture.Rd
e6b5e5d28e0568ae580698aedc39ce7b *man/character_class.Rd
7d1bef01e0bdcb952ac2d02e79843a49 *man/character_class_escape.Rd
71199713c5dee405fbdc50d68555e3e3 *man/counts.Rd
e5005a10ac3db05cb9479ed7bfaf9884 *man/escape.Rd
ba74c58103f45b572656ce0f32824946 *man/group.Rd
b56779e62923bfa2091d47231833f439 *man/lookarounds.Rd
abf3c65539fb32ae2f69b1d626901294 *man/not.Rd
b1d3f789560b862f3dce3c0bbc9802a8 *man/or.Rd
7f15d9fd60f36bb4743cfb0fafeea78e *man/pipe.Rd
65ff3d483d5777925dd4da48462c115d *man/re_matches.Rd
f4cbc420ebe6f4b18388f42de81b59a9 *man/re_substitutes.Rd
a3e16f3c76a91382e10be79d89ead291 *man/regex.Rd
576e0d7009140ddddedd4cf379a1daf9 *man/register_shortcuts.Rd
ec0865058822ede969df8e90c48cce68 *man/rex.Rd
cfe7d4b7fe124ec8360d9ca3d1c00d5b *man/rex_mode.Rd
2370863be53dfd1689a189714e559b9c *man/shortcuts.Rd
db58ac44ef5f05ab79a10a1a9b365144 *man/single_shortcuts.Rd
2f2c52634e62b91fa643363bc6799d2a *man/wildcards.Rd
a33e8fa7e101e58fbd3e040566dc1ca3 *man/capture.Rd
ab8b7fc364622a431f7606f38b5a48ec *man/character_class.Rd
464b0ae52a588e856d320d9a5bc3e954 *man/character_class_escape.Rd
1366002eaec67650d7d783b9b857134d *man/counts.Rd
c4d49be8d7113417ec8306dac065e6fa *man/escape.Rd
1c072a1f272cfae1fbbf28728152d52c *man/group.Rd
0b34b4fa838475e16746761b25e0d6e9 *man/lookarounds.Rd
7a1462cbe7a86ecd272c6da02e4a1750 *man/not.Rd
46d35e3775a526639a847ba92fae039c *man/or.Rd
a64a7ea44fcaa33c2d3ad0f7909cbc3e *man/pipe.Rd
ce9efbfb53f1d57907baf317e136f5ea *man/re_matches.Rd
2f3c777ef19000b73df9240172cb7e26 *man/re_substitutes.Rd
d4251542543cbc53aa3e0a894ad4a55f *man/regex.Rd
a2f005243efa94175ef55c8b7265b689 *man/register_shortcuts.Rd
9c5a30b2cf7845e88ffc1b58d8764580 *man/rex.Rd
8aed86b57e383e0529aac57cf289e00e *man/rex_mode.Rd
520e45cdc56e80cf8a3880e477cf8d5f *man/shortcuts.Rd
c20524af3764e8dd98262112e80d26e4 *man/single_shortcuts.Rd
66a9d5643b0694cd8af17f7490bd909d *man/wildcards.Rd
ab1b350e9f314cd19cad3a33f3d15d22 *tests/testthat.R
8460417b6ecacce6923c11f0cc00e7c4 *tests/testthat/test-aaa.R
fd21760f84c5daa4219d2d489f8680cb *tests/testthat/test-capture.R
Expand All @@ -54,11 +54,11 @@ f7a85c573c11ec2a129ae953049daf6e *tests/testthat/test-counts.R
b2353c062e208fe39c66b21bf2e46bc9 *tests/testthat/test-lookarounds.R
7b1a951319321a17f7c972365471306b *tests/testthat/test-match.R
2954762867e70d58745fdac2d23df348 *tests/testthat/test-or.R
d70536ad5b29d31f59a83313897f0623 *tests/testthat/test-print.R
90482fba54455f93d8cb2370246688d9 *tests/testthat/test-print.R
217ef7f57c6eba4353c876656a86736f *tests/testthat/test-rex_mode.R
472bc0c571d28a35dede6d62b34d73cd *tests/testthat/test-shortcuts.R
ab9274947f4a6b7e133cdec30b5341c7 *tests/testthat/test-wildcards.R
959347e409b042544213f8fae02d991b *vignettes/NASA.txt
856eae22b696240b244ce83e9796f0fb *vignettes/log_parsing.Rmd
9838c708dc0669c5a14d59cb412cd5cd *vignettes/stackoverflow.R
c8ecf989d67c1e4498982fa390c34725 *vignettes/url_parsing.Rmd
148cd376374385379c63ae6c70161638 *vignettes/url_parsing.Rmd
5 changes: 5 additions & 0 deletions NAMESPACE
Expand Up @@ -2,6 +2,7 @@

S3method(as.character,regex)
S3method(as.regex,default)
S3method(c,regex)
S3method(character_class_escape,character)
S3method(character_class_escape,character_class)
S3method(character_class_escape,default)
Expand All @@ -18,12 +19,16 @@ export(as.regex)
export(character_class)
export(character_class_escape)
export(escape)
export(m)
export(matches)
export(re_matches)
export(re_substitutes)
export(regex)
export(register_shortcuts)
export(rex)
export(rex_)
export(rex_mode)
export(s)
export(shortcuts)
export(substitutes)
importFrom(magrittr,"%>%")
7 changes: 7 additions & 0 deletions NEWS.md
@@ -1,3 +1,10 @@
## Rex Version 1.1.2 ##

* Updating tests to work with testthat version 1.0.2.9000.

* Add `m`, `matches` and `s`, `substitutes` aliases for `re_matches` and
`re_substitutes`.

## Rex Version 1.1.1 ##

* Vignette tweak for ggplot2 2.0.0
Expand Down
8 changes: 5 additions & 3 deletions R/match.R
Expand Up @@ -31,7 +31,8 @@
#' # 1
#' # 1 test
#' # 2 <NA>
#' @export
#' @aliases matches m
#' @export re_matches matches m
re_matches <- matches <- m <- function(data, pattern, global = FALSE, options = NULL, locations = FALSE, ...) {

pattern <- add_options(pattern, options)
Expand Down Expand Up @@ -81,7 +82,7 @@ re_matches <- matches <- m <- function(data, pattern, global = FALSE, options =
ends[not_matched] <- NA_integer_

indexes <- unlist(lapply(seq_len(ncol(res)), function(x) {
seq(x, b = ncol(res), length.out = 3)
seq(x, by = ncol(res), length.out = 3)
}))

full <- data.frame(res, starts, ends, stringsAsFactors = FALSE, check.names = FALSE)[, indexes, drop = FALSE]
Expand Down Expand Up @@ -114,7 +115,8 @@ re_matches <- matches <- m <- function(data, pattern, global = FALSE, options =
#' re_substitutes(string, "test", "not a test", options = "insensitive")
#' re_substitutes(string, "i", "x", global = TRUE)
#' re_substitutes(string, "(test)", "not a \\1", options = "insensitive")
#' @export
#' @aliases substitutes s
#' @export re_substitutes substitutes s
re_substitutes <- substitutes <- s <- function(data, pattern, replacement, global = FALSE, options = NULL, ...) {
pattern <- add_options(pattern, options)
method <- if (isTRUE(global)) gsub else sub
Expand Down
5 changes: 5 additions & 0 deletions R/rex.R
Expand Up @@ -66,3 +66,8 @@ regex <- function(x, ...) structure(x, class = "regex")
register_shortcuts <- function(pkg_name) {
invisible(utils::globalVariables(ls(.rex$env), pkg_name))
}

#' @export
c.regex <- function(..., recursive = FALSE) {
regex(c(unlist(lapply(list(...), unclass))))
}
2 changes: 1 addition & 1 deletion README.md
@@ -1,6 +1,6 @@
# Rex
[![Build Status](https://travis-ci.org/kevinushey/rex.png?branch=master)](https://travis-ci.org/kevinushey/rex)
[![Coverage Status](https://img.shields.io/coveralls/kevinushey/rex.svg)](https://coveralls.io/r/kevinushey/rex)
[![codecov.io](https://codecov.io/github/kevinushey/rex/coverage.svg?branch=master)](https://codecov.io/github/kevinushey/rex?branch=master)

### Friendly Regular Expressions

Expand Down
Binary file modified build/vignette.rds
Binary file not shown.
11 changes: 3 additions & 8 deletions inst/doc/log_parsing.R
Expand Up @@ -5,7 +5,7 @@ library(knitr)
library(ggplot2)

## ----show.warnings=FALSE-------------------------------------------------
parsed <- scan('NASA.txt', what = "character", sep = "\n") %>%
parsed <- scan("NASA.txt", what = "character", sep = "\n") %>%
re_matches(
rex(

Expand All @@ -21,7 +21,7 @@ parsed <- scan('NASA.txt', what = "character", sep = "\n") %>%
# Get the filetype of the request if requesting a file
maybe(
non_spaces, ".",
capture(name = 'filetype',
capture(name = "filetype",
except_some_of(space, ".", "?", double_quote)
)
)
Expand All @@ -34,11 +34,6 @@ parsed <- scan('NASA.txt', what = "character", sep = "\n") %>%
kable(head(parsed, n = 10))

## ----FALSE, fig.show='hold', warning = FALSE, message = FALSE------------
x_angle <- theme(axis.text.x = element_text(size = 7,
hjust = 0,
vjust = 1,
angle = 310))

ggplot(na.omit(parsed)) + geom_histogram(aes(x=filetype)) + x_angle
ggplot(na.omit(parsed)) + stat_count(aes(x=filetype))
ggplot(na.omit(parsed)) + geom_histogram(aes(x=time)) + ggtitle("Requests over time")

11 changes: 3 additions & 8 deletions inst/doc/log_parsing.Rmd
Expand Up @@ -33,7 +33,7 @@ library(ggplot2)
```

```{r show.warnings=FALSE}
parsed <- scan('NASA.txt', what = "character", sep = "\n") %>%
parsed <- scan("NASA.txt", what = "character", sep = "\n") %>%
re_matches(
rex(
Expand All @@ -49,7 +49,7 @@ parsed <- scan('NASA.txt', what = "character", sep = "\n") %>%
# Get the filetype of the request if requesting a file
maybe(
non_spaces, ".",
capture(name = 'filetype',
capture(name = "filetype",
except_some_of(space, ".", "?", double_quote)
)
)
Expand All @@ -66,11 +66,6 @@ kable(head(parsed, n = 10))

We can also easily generate a histogram of the filetypes, or a plot of requests over time.
```{r FALSE, fig.show='hold', warning = FALSE, message = FALSE}
x_angle <- theme(axis.text.x = element_text(size = 7,
hjust = 0,
vjust = 1,
angle = 310))
ggplot(na.omit(parsed)) + geom_histogram(aes(x=filetype)) + x_angle
ggplot(na.omit(parsed)) + stat_count(aes(x=filetype))
ggplot(na.omit(parsed)) + geom_histogram(aes(x=time)) + ggtitle("Requests over time")
```

0 comments on commit f8d5cf1

Please sign in to comment.