{"id":14068899,"url":"https://github.com/r-lib/rex","last_synced_at":"2025-12-12T01:04:51.725Z","repository":{"id":21052709,"uuid":"24351713","full_name":"r-lib/rex","owner":"r-lib","description":"Friendly regular expressions for R.","archived":false,"fork":false,"pushed_at":"2024-03-12T22:42:22.000Z","size":5043,"stargazers_count":334,"open_issues_count":22,"forks_count":27,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-03-29T19:06:07.196Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://rex.r-lib.org","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/r-lib.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-09-23T01:13:17.000Z","updated_at":"2025-03-22T08:13:15.000Z","dependencies_parsed_at":"2024-03-12T23:39:24.850Z","dependency_job_id":null,"html_url":"https://github.com/r-lib/rex","commit_stats":{"total_commits":204,"total_committers":11,"mean_commits":"18.545454545454547","dds":0.196078431372549,"last_synced_commit":"925a4d1b9a5be80f3317301a235e3ac15bc17fff"},"previous_names":["kevinushey/rex"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Frex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Frex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Frex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Frex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/r-lib","download_url":"https://codeload.github.com/r-lib/rex/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247393573,"owners_count":20931813,"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":[],"created_at":"2024-08-13T07:06:28.369Z","updated_at":"2025-12-12T01:04:51.644Z","avatar_url":"https://github.com/r-lib.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"# Rex\n\n\u003c!-- badges: start --\u003e\n[![Codecov test coverage](https://codecov.io/gh/kevinushey/rex/branch/master/graph/badge.svg)](https://app.codecov.io/gh/kevinushey/rex?branch=main)\n[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html)\n[![R-CMD-check](https://github.com/kevinushey/rex/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/kevinushey/rex/actions/workflows/R-CMD-check.yaml)\n\u003c!-- badges: end --\u003e\n\n### Friendly Regular Expressions\n\nRegular expressions are very powerful feature, however they are often difficult\nto interpret. Rex allows you to build complex regular expressions from human\nreadable expressions.  So instead of writing (and later trying to decipher)\n```r\nr \u003c- \"^(?:(((?:[^:])+)://))?((?:(?:(?!:/).)*)+)(?:(:([[:digit:]]+)))?(?:(/.*))?$\"\n```\n\nYou can write\n\n```r\nr \u003c- rex(\n\n  start,\n\n  ## match the protocol -- may exist or may not\n  maybe(capture(\n      capture(except_some_of(\":\")),\n      \"://\"\n      )),\n\n  ## match the path\n  capture(one_or_more(not(\":/\"))),\n\n  ## get the port\n  maybe(capture(\":\", capture(numbers))),\n\n  ## and the rest\n  maybe(capture(\"/\", anything)),\n\n  end\n\n)\n```\n\nWhile these expressions are a bit longer than their corresponding regular\nexpression, they are much more readable and maintainable.\n\n## Installation\n\n```r\ninstall.packages(\"rex\")\n```\n\n## Usage\n\nThe vignettes have longer form usage examples.\n\n- [URL Validation](http://rpubs.com/jimhester/rex-url_parsing)\n- [Webserver Log Parsing](http://rpubs.com/jimhester/rex-log_parsing)\n\nEach `rex()` function call can include a number of functions and shortcuts.\nFor a full list of the functions available please see `?rex` and `?shortcuts`.\n\n### Rex Mode\n\nRex functions are not exported because they are only useful within `rex()`\ncalls, but they can be temporarily attached using `rex_mode()` which allows\nthem to be auto-completed.\n\n### Using Rex in other packages\n\nUsing `rex` in other packages will generate spurious NOTEs from `R CMD check`\nunless you include a call to `rex::register_shortcuts()` with your package name\nsomewhere in your package source.  This function registers all of the rex\nshortcuts as valid variables fixing the NOTEs.\n\n## See Also\n- [Regularity](https://github.com/andrewberls/regularity) - Ruby library that\n  partially inspired `rex`.\n- [PCRE](http://www.pcre.org/) - Perl Compatible Regular Expressions, the\n  engine that `rex` regular expressions use.\n- [Perl 5 Regular Expressions](https://perldoc.perl.org/perlre) - Perl\n  regular expression documentation, which are nearly 100% compatible with PCRE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-lib%2Frex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fr-lib%2Frex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-lib%2Frex/lists"}