README.md

RegulaR

Regular expressions for humans, a port of Ruby's Regularity library

Build Status

Development of this library is moving to rex, which provides a more robust R friendly framework

regulaR is a human friendly regular expression builder for R. While regular expressions are a powerful way to match text, they are sometimes difficult to document and understand when written. R also has escaping issues with regular expression this library hopes to solve.

So instead of writing

regex = "^[0-9]{3}-[A-Za-z]{2}#?(?:a|b)c{2,4}\\$$"

You can write


regex = regulaR() %>% start_with(3, digits) %>%
  then('-') %>%
  then(2L, letters) %>%
  maybe('#') %>%
  one_of(c('a','b')) %>%
  between(c(2L,4L), 'c') %>%
  end_with('$')

See Also

This package is inspired by @hadley's tweet



jimhester/regulaR documentation built on May 19, 2019, 10:33 a.m.