Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/verbalexpressions/rverbalexpressions
:speech_balloon: Create regular expressions easily
https://github.com/verbalexpressions/rverbalexpressions
r regex regular-expressions verbal-expressions
Last synced: 4 days ago
JSON representation
:speech_balloon: Create regular expressions easily
- Host: GitHub
- URL: https://github.com/verbalexpressions/rverbalexpressions
- Owner: VerbalExpressions
- License: other
- Created: 2019-03-01T23:44:40.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-03-20T16:35:55.000Z (8 months ago)
- Last Synced: 2024-10-28T17:32:46.602Z (17 days ago)
- Topics: r, regex, regular-expressions, verbal-expressions
- Language: R
- Homepage: https://rverbalexpressions.netlify.com/
- Size: 874 KB
- Stars: 280
- Watchers: 9
- Forks: 12
- Open Issues: 8
-
Metadata Files:
- Readme: README.Rmd
- Contributing: docs/CONTRIBUTING.html
- License: LICENSE
Awesome Lists containing this project
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```# RVerbalExpressions
[![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/phr93q0rp7edf376?svg=true)](https://ci.appveyor.com/project/tyluRp/rverbalexpressions-4tt0n)
[![CRAN status](https://www.r-pkg.org/badges/version/RVerbalExpressions)](https://CRAN.R-project.org/package=RVerbalExpressions)
[![CRAN_Download_Badge](https://cranlogs.r-pkg.org/badges/RVerbalExpressions)](https://cran.r-project.org/package=RVerbalExpressions)The goal of `RVerbalExpressions` is to make it easier to construct regular expressions using grammar and functionality inspired by [VerbalExpressions](https://github.com/VerbalExpressions). Usage of `%>%` is encouraged to build expressions in a chain like fashion.
## Installation
Install the released version of `RVerbalExpressions` from [CRAN](https://cran.r-project.org/package=RVerbalExpressions):
```r
install.packages("RVerbalExpressions")
```Or install the development version from GitHub with:
``` r
# install.packages("devtools")
devtools::install_github("VerbalExpressions/RVerbalExpressions")
```## Example
This is a basic example which shows you how to build a regular expression:
```{r example, message=FALSE}
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# test for a match
grepl(x, "https://www.google.com")
```## Other Implementations
You can see an up to date list of all ports on [VerbalExpressions.github.io](https://VerbalExpressions.github.io).
- [JavaScript](https://github.com/VerbalExpressions/JSVerbalExpressions)
- [Ruby](https://github.com/ryan-endacott/verbal_expressions)
- [C#](https://github.com/VerbalExpressions/CSharpVerbalExpressions)
- [Python](https://github.com/VerbalExpressions/PythonVerbalExpressions)
- [Java](https://github.com/VerbalExpressions/JavaVerbalExpressions)
- [Groovy](https://github.com/VerbalExpressions/GroovyVerbalExpressions)
- [PHP](https://github.com/VerbalExpressions/PHPVerbalExpressions)
- [Haskell](https://github.com/VerbalExpressions/HaskellVerbalExpressions)
- [Haxe](https://github.com/VerbalExpressions/HaxeVerbalExpressions)
- [C++](https://github.com/VerbalExpressions/CppVerbalExpressions)
- [Objective-C](https://github.com/VerbalExpressions/ObjectiveCVerbalExpressions)
- [Perl](https://github.com/VerbalExpressions/PerlVerbalExpressions)
- [Swift](https://github.com/VerbalExpressions/SwiftVerbalExpressions)Additionally, there are two R packages that try to solve the same problem. I encourage you to check these out:
1. [rex](https://github.com/r-lib/rex) by [\@kevinushey](https://twitter.com/kevin_ushey)
2. [rebus](https://github.com/richierocks/rebus) by [\@richierocks](https://twitter.com/richierocks?lang=en)## Contributing
If you find any issues, typos, etc., please file an issue or submit a PR. All contributions are welcome!