Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jimhester/regular

Regular expressions for humans, a port of Ruby's Regularity library to R (see https://github.com/kevinushey/rex for current development)
https://github.com/jimhester/regular

Last synced: 3 months ago
JSON representation

Regular expressions for humans, a port of Ruby's Regularity library to R (see https://github.com/kevinushey/rex for current development)

Awesome Lists containing this project

README

        

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

[![Build Status](https://travis-ci.org/jimhester/regulaR.png?branch=master)](https://travis-ci.org/jimhester/regulaR)

## Development of this library is moving to [rex](https://github.com/kevinushey/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
```r
regex = "^[0-9]{3}-[A-Za-z]{2}#?(?:a|b)c{2,4}\\$$"
```

You can write
```r

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
- [rex](https://github.com/kevinushey/rex) for an alternate (better?) implementation

This package is inspired by @hadley's [tweet](https://twitter.com/hadleywickham/status/514102801081708544)