{"id":13665898,"url":"https://github.com/gadenbuie/regexplain","last_synced_at":"2025-04-05T19:13:58.436Z","repository":{"id":76832929,"uuid":"124287393","full_name":"gadenbuie/regexplain","owner":"gadenbuie","description":"🔍 An RStudio addin slash regex utility belt","archived":false,"fork":false,"pushed_at":"2021-11-04T03:47:42.000Z","size":36803,"stargazers_count":486,"open_issues_count":2,"forks_count":27,"subscribers_count":17,"default_branch":"main","last_synced_at":"2025-03-29T18:08:27.813Z","etag":null,"topics":["gadget","regex","regex-expression","regular-expression","rstats","rstudio-addin","shiny","stringr"],"latest_commit_sha":null,"homepage":"https://www.garrickadenbuie.com/project/regexplain/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gadenbuie.png","metadata":{"files":{"readme":"Readme.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-03-07T19:58:35.000Z","updated_at":"2025-02-08T00:41:26.000Z","dependencies_parsed_at":"2024-01-19T14:23:12.106Z","dependency_job_id":"13a526b2-3a4e-4365-8f85-8d202992f5dc","html_url":"https://github.com/gadenbuie/regexplain","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gadenbuie%2Fregexplain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gadenbuie%2Fregexplain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gadenbuie%2Fregexplain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gadenbuie%2Fregexplain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gadenbuie","download_url":"https://codeload.github.com/gadenbuie/regexplain/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247386266,"owners_count":20930619,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gadget","regex","regex-expression","regular-expression","rstats","rstudio-addin","shiny","stringr"],"created_at":"2024-08-02T06:00:53.254Z","updated_at":"2025-04-05T19:13:58.417Z","avatar_url":"https://github.com/gadenbuie.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"---\ntitle: \"RegExplain\"\noutput: github_document\n---\n\n```{r setup, include=FALSE}\nknitr::opts_chunk$set(echo = TRUE, fig.path = \"man/figures/Readme-\")\nlibrary(regexplain)\n```\n\n#### *Regular expressions are tricky.* RegExplain *makes it easier to see what you're doing.*\n\n\u003c!-- [![packageversion](https://img.shields.io/github/description/v/gadenbuie/regexplain.svg)](commits/master) --\u003e\n![](https://img.shields.io/badge/lifecycle-maturing-blue.svg)\n[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active)\n[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/regexplain)](https://cran.r-project.org/package=regexplain)\n\u003c!-- [![Last-changedate](https://img.shields.io/badge/last%20change-`r gsub('-', '--', Sys.Date())`-yellowgreen.svg)](/commits/master) --\u003e\n\n\u003c!-- Links --\u003e\n[regexr]: https://regexr.com/\n\n**RegExplain** is an RStudio addin slash utility belt for regular expressions.\nInteractively build your regexp, check the output of common string matching functions, consult the interactive help pages, or use the included resources to learn regular expressions.\nAnd more.\n\nInspired by [RegExr.com][regexr] and `stringr::str_view()`.\n\n## Installation\n\nInstallation is easy with `remotes`\n\n```r\n# install.packages(\"remotes\")\nremotes::install_github(\"gadenbuie/regexplain\")\n```\n\n## RegExplain in Action\n\n#### Overview\n\n![regexplain selection](https://raw.githubusercontent.com/gadenbuie/regexplain/af4fe0988a10f34dc528b4d359b80bb06af7809a/docs/regexplain-selection.gif)\n\n#### Regular Expressions Library\n\n![regexplain library](https://raw.githubusercontent.com/gadenbuie/regexplain/af4fe0988a10f34dc528b4d359b80bb06af7809a/docs/regexplain-library.gif)\n\n#### Try the Built-In Examples\n\n![regexplain examples](https://raw.githubusercontent.com/gadenbuie/regexplain/af4fe0988a10f34dc528b4d359b80bb06af7809a/docs/regexplain-try-this.gif)\n\n## RStudio Addin\n\nThe main feature of this package is the RStudio Addin **RegExplain Selection**.\nJust select the text or object containing text (such as the variable name of a vector or a data.frame column) and run **RegExplain Selection** from the RStudio Addins dropdown.\n\n\u003cimg src=\"docs/rstudio-addin-list.png\" width = \"250px;\" alt=\"regexplain in the Rstudio Addins dropdown\"\u003e\n\nYou can also open the addin with `regexplain_gadget()`. \nThis allows you to pass text or a regular expression to the gadget, which is useful when you want to work with a regular expression in your code or environment.\n\n```r\nregexplain_gadget(text_vector, \"\\\\b(red|blue|green): \\\\d{3}\")\n```\n\nThe addin will open an interface with 4 panes where you can\n\n- edit the **text** you've imported\n- build up a **regex** expression and interactively see it applied to your text\n- test the **output** of common string matching and replacement functions from `base` and `stringr`\n- and refer to a **help**ful cheatsheet\n\n![The panes of regexplain](docs/regexplain-gadget-tabs.png)\n\nWhen you're done, click on the **Send Regex to Console** to send your regex expression to... the console!\n\n```r\n\u003e pattern \u003c- \"\\\\b(red|orange|yellow|green|blue|purple|white|brown)(?:\\\\s(\\\\w+))?\"\n```\n\nNotice that _RegExplain_ handled the extra backslashes needed for storing the RegEx characters `\\b`, `\\s`, and `\\w`.\nInside the gadget you can use regular old regular expressions as you found them in the wild (hello, [Stack Overflow](https://stackoverflow.com/questions/tagged/regex)!).\n\n### Help and Cheat Sheet\n\nThe **Help** tab is full of resources, guides, and R packages and includes an easy-to-navigate reference of commonly used regular expression syntax.\n\n![regexplain help windows](docs/regexplain-gadget-help.png)\n\nOpen **RegExplain Cheatsheet** from the RStudio Addins drop down to open the regex reference page in the Viewer pane without blocking your current R session.\n\n### Import Your Text\n\nThere are two ways to get your text into *RegExplain*.\nThe first way was described above: select an object name or lines of text or code in the RStudio source pane and run **RegExplain Selection**.\nTo import text from a file, use **RegExplain File** to you import the text you want to process with regular expressions.\n\nWhen importing text, _RegExplain_ automatically reduces the text to the unique entries and limits the number of lines.\n\n![regexplain addins](docs/addin-screenshots.png)\n\n### Regular Expressions Library\n\nThe _RegExplain_ gadget includes a regular expressions library in the **RegEx** tab.\nThe library features common regular expressions, sourced from [qdapRegex](https://github.com/trinker/qdapRegex) and [Regex Hub](https://projects.lukehaas.me/regexhub), with several additional patterns.\n\nThe full library is stored as a JSON file in [inst/extdata/patterns.json](/inst/extdata/patterns.json), feel free to contribute patterns you find useful or use regularly via pull request.\n\n\u003cimg src=\"docs/regexplain-gadget-library.png\" height=\"400px\" alt=\"regexplain library modal\"\u003e\n\n## View Static Regex Results\n\n_RegExplain_ provides the function `view_regex()` that you can use as a `stringr::str_view()` replacement.\nIn addition to highlighting matched portions of the text, `view_regex()` colorizes groups and attempts to colorize the regex expression itself as well.\n\n```r\ntext \u003c- c(\"breakfast=eggs;lunch=pizza\",\n          \"breakfast=bacon;lunch=spaghetti\", \n          \"no food here\")\npattern \u003c- \"((\\\\w+)=)(\\\\w+).+(ch=s?p)\"\n\nview_regex(text, pattern)\n```\n\n![Example `view_regex(text, pattern)`.](docs/view-regex.png)\n\n```r\nt_nested \u003c- \"anestedgroupwithingroupexample\"\nr_nested \u003c- \"(a(nested)(group(within(group))(example)))\"\nview_regex(t_nested, r_nested)\n```\n\n![Example of nested groups](docs/view-nested.png)\n\n\n## Notes\n\nRegular expressions are nothing if not a collection of corner cases.\nTrying to pass regular expressions through Shiny and HTML inputs is a bit of a labyrinth.\nFor now, assume any issues or oddities you experience with this addin are entirely my fault and have nothing to do with the fine packages this addin is built on.\nIf you do find an issue, [please file an issue](https://github.com/gadenbuie/regexplain).\nPull requests are welcomed!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgadenbuie%2Fregexplain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgadenbuie%2Fregexplain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgadenbuie%2Fregexplain/lists"}