Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adamspannbauer/r_regex_tester_app
Shiny Application to test regular expressions in R
https://github.com/adamspannbauer/r_regex_tester_app
grepl gsub regex regex-tester rstats stringr
Last synced: 2 months ago
JSON representation
Shiny Application to test regular expressions in R
- Host: GitHub
- URL: https://github.com/adamspannbauer/r_regex_tester_app
- Owner: AdamSpannbauer
- License: other
- Created: 2017-03-30T11:15:35.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-04-12T15:46:46.000Z (over 2 years ago)
- Last Synced: 2024-10-12T16:26:00.649Z (3 months ago)
- Topics: grepl, gsub, regex, regex-tester, rstats, stringr
- Language: R
- Homepage: https://spannbaueradam.shinyapps.io/r_regex_tester/
- Size: 54.3 MB
- Stars: 66
- Watchers: 2
- Forks: 9
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# R Regex Tester Shiny App
[![Build Status](https://app.travis-ci.com/AdamSpannbauer/r_regex_tester_app.svg?branch=master)](https://app.travis-ci.com/github/AdamSpannbauer/r_regex_tester_app) [![Codecov test coverage](https://codecov.io/gh/AdamSpannbauer/r_regex_tester_app/branch/master/graph/badge.svg)](https://codecov.io/gh/AdamSpannbauer/r_regex_tester_app?branch=master) [![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/regexTestR)](https://CRAN.R-project.org/package=regexTestR) [![Last Commit](https://img.shields.io/github/last-commit/AdamSpannbauer/r_regex_tester_app.svg)](https://github.com/AdamSpannbauer/r_regex_tester_app/commits/master) ![](http://cranlogs.r-pkg.org/badges/grand-total/regexTestR)
## Usage
### Online
* Visit the application live on [shinyapps.io](https://spannbaueradam.shinyapps.io/r_regex_tester/).
### Local
* Install package
```r
# Option 1: install from CRAN
install.packages("regexTestR")# Option 2: install dev version from github
devtools::install_github("AdamSpannbauer/r_regex_tester_app")
```* Run app
```r
regexTestR::run_app()
```## Features
### Options
* Use the common options used across the R [Pattern Matching and Replacement](https://stat.ethz.ch/R-manual/R-devel/library/base/html/grep.html) family of functions.
* The other 2 options concerning backslashes allow you to write an R flavored regex.
* For example, if you want to match a literal period with a regex you'll type "\\\\." (as if you were writing the regex in R).
* If you don't like this behavior, and you'd rather type half of the slashes needed to make the regex functional in R, you can select the "Auto Escape Backslashes" option for "Pattern" and then use "\\." to match literal periods in the app.### Input
* There are 2 text inputs:
1. __Matching Pattern__: type the regular expression or fixed pattern here that you want to use to match against your text.
2. __Test String__: type the text that you want your Matching Pattern to search through
### Results
* After the pattern and test string are entered we see 2 different versions of the resulting pattern matching:
1. The test string is shown with the matches/capture groups highlighted where they appear in the text
* As noted in the UI, currently nested capture group highlighting isn't supported. If our matching pattern was "t(e(s))(t)" the highlighting wouldn't display correctly.
2. The second output is a bulleted list of the matches and capture groups found in our test string. In the screen shot below we see we matched 2 instances of "test", and each of these matches display below them the contents of the 2 capture groups we included in our regex pattern.
### Regex Explanation
* There's additionally a collapsable panel that will do it's best to break down your regex and explain the components. As noted in the UI these explanations are provided by [rick.measham.id.au](http://rick.measham.id.au/paste/explain)
* The screen shot below shows the explanation for our regex: "t(es)(t)"
### Helping Documentation
* The app includes some documentation for using regular expressions in R. The two including pieces of helping documentaion are:
1. The [RStudio](https://www.rstudio.com/) Regex Cheatsheet
2. The base R documentation on regex (this is what would appear if you ran the command `?regex`)### Extra
Shiny's bootstrap roots allow apps to transition between desktop and mobile pretty seamlessly. The app's mobile experience isn't terrible, so you can use it for all your regex-ing fun on the go! (I won't ask why)