Skip to content
💬 Create regular expressions easily
R
Branch: master
Clone or download
Latest commit a85308d Nov 6, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R prep resubmission Nov 6, 2019
docs add cran link Nov 7, 2019
man
pkgdown/favicon us rx.string method for nested rx Sep 20, 2019
tests us rx.string method for nested rx Sep 20, 2019
vignettes remove diff vignette Sep 21, 2019
.Rbuildignore wrap up cran release Nov 7, 2019
.gitignore Initial commit Mar 1, 2019
.travis.yml remove devel Mar 7, 2019
DESCRIPTION wrap up cran release Nov 7, 2019
LICENSE Initial commit Mar 1, 2019
LICENSE.md
NAMESPACE cran prep Nov 3, 2019
NEWS.md prep resubmission Nov 6, 2019
README.Rmd add cran link Nov 7, 2019
README.md add cran link Nov 7, 2019
RVerbalExpressions.Rproj Initial commit Mar 1, 2019
_pkgdown.yml rearrange some of the functions and what files they belong to, adjust… Mar 24, 2019
appveyor.yml fix appveyor Mar 1, 2019
codecov.yml add badges Mar 1, 2019

README.md

RVerbalExpressions

Travis build status AppVeyor Build status CRAN status CRAN_Download_Badge Codecov test coverage

The goal of RVerbalExpressions is to make it easier to construct regular expressions using grammar and functionality inspired by VerbalExpressions. Usage of %>% is encouraged to build expressions in a chain like fashion.

Installation

Install the released version of RVerbalExpressions from CRAN:

install.packages("RVerbalExpressions")

Or install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("VerbalExpressions/RVerbalExpressions")

Example

This is a basic example which shows you how to build a regular expression:

library(RVerbalExpressions)

# construct an expression
x <- rx_start_of_line() %>% 
  rx_find('http') %>% 
  rx_maybe('s') %>% 
  rx_find('://') %>% 
  rx_maybe('www.') %>% 
  rx_anything_but(' ') %>% 
  rx_end_of_line()

# print the expression
x
#> [1] "^(http)(s)?(\\://)(www\\.)?([^ ]*)$"

# test for a match
grepl(x, "https://www.google.com")
#> [1] TRUE

Other Implementations

You can see an up to date list of all ports on VerbalExpressions.github.io.

Additionally, there are two R packages that try to solve the same problem. I encourage you to check these out:

  1. rex by @kevinushey
  2. rebus by @richierocks

Contributing

If you find any issues, typos, etc., please file an issue or submit a PR. All contributions are welcome!

You can’t perform that action at this time.