Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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)
- Host: GitHub
- URL: https://github.com/jimhester/regular
- Owner: jimhester
- License: mit
- Created: 2014-09-22T21:06:38.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-09-24T13:52:16.000Z (over 10 years ago)
- Last Synced: 2024-06-11T18:20:04.286Z (7 months ago)
- Language: R
- Homepage:
- Size: 124 KB
- Stars: 20
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
```rregex = 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?) implementationThis package is inspired by @hadley's [tweet](https://twitter.com/hadleywickham/status/514102801081708544)