:construction_worker_man: :speech_balloon: RVerbalExpressions

Travis build
status AppVeyor Build
status Codecov test
coverage Lifecycle:
experimental Netlify

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.


You can install RVerbalExpressions from GitHub with:

# install.packages("devtools")


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


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

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

# test for a match
grepl(x, "")
#> [1] TRUE

Other Implementations

You can see an up to date list of all ports on

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


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

VerbalExpressions/RVerbalExpressions documentation built on May 14, 2019, 11:02 p.m.