{"id":28359949,"url":"https://github.com/gorilla/reverse","last_synced_at":"2025-10-24T17:11:37.235Z","repository":{"id":4896230,"uuid":"6051862","full_name":"gorilla/reverse","owner":"gorilla","description":"Package gorilla/reverse is a set of utilities to create request routers.","archived":false,"fork":false,"pushed_at":"2023-11-05T22:00:30.000Z","size":22,"stargazers_count":56,"open_issues_count":0,"forks_count":14,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-06-04T16:24:07.512Z","etag":null,"topics":["go","golang","gorilla","gorilla-web-toolkit","http","router"],"latest_commit_sha":null,"homepage":"https://gorilla.github.io","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"oclint/oclint","license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gorilla.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":"2012-10-02T21:36:46.000Z","updated_at":"2025-03-29T16:50:49.000Z","dependencies_parsed_at":"2022-08-26T11:10:13.072Z","dependency_job_id":"b43bdf8b-a02b-473d-98ec-d2f849bc3a68","html_url":"https://github.com/gorilla/reverse","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/gorilla/reverse","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gorilla%2Freverse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gorilla%2Freverse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gorilla%2Freverse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gorilla%2Freverse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gorilla","download_url":"https://codeload.github.com/gorilla/reverse/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gorilla%2Freverse/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261372233,"owners_count":23148786,"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":["go","golang","gorilla","gorilla-web-toolkit","http","router"],"created_at":"2025-05-28T10:10:43.730Z","updated_at":"2025-10-24T17:11:37.218Z","avatar_url":"https://github.com/gorilla.png","language":"Go","readme":"# reverse\n\n![testing](https://github.com/gorilla/reverse/actions/workflows/test.yml/badge.svg)\n[![codecov](https://codecov.io/github/gorilla/reverse/branch/main/graph/badge.svg)](https://codecov.io/github/gorilla/reverse)\n[![godoc](https://godoc.org/github.com/gorilla/reverse?status.svg)](https://godoc.org/github.com/gorilla/reverse)\n[![sourcegraph](https://sourcegraph.com/github.com/gorilla/reverse/-/badge.svg)](https://sourcegraph.com/github.com/gorilla/reverse?badge)\n\n![Gorilla Logo](https://github.com/gorilla/.github/assets/53367916/d92caabf-98e0-473e-bfbf-ab554ba435e5)\n\nPackage gorilla/reverse is a set of utilities to create request routers.\n\nIt provides interfaces to match and extract variables from an HTTP request\nand build URLs for registered routes. It also has a variety of matcher\nimplementations for all kinds of request attributes, among other utilities.\n\nFor example, the Regexp type produces reversible regular expressions that\ncan be used to generate URLs for a regexp-based mux. To demonstrate, let's\ncompile a simple regexp:\n\n```go\nregexp, err := reverse.CompileRegexp(`/foo/1(\\d+)3`)\n```\n\nNow we can call regexp.Revert() passing variables to fill the capturing groups.\nBecause our variable is not named, we use an empty string as key for\nurl.Values, like this:\n\n```go\n// url is \"/foo/123\".\nurl, err := regexp.Revert(url.Values{\"\": {\"2\"}})\n```\n\nNon-capturing groups are ignored, but named capturing groups can be filled\nnormally. Just set the key in url.Values:\n\n```go\nregexp, err := reverse.CompileRegexp(`/foo/1(?P\u003ctwo\u003e\\d+)3`)\nif err != nil {\n    panic(err)\n}\n// url is \"/foo/123\".\nurl, err := re.Revert(url.Values{\"two\": {\"2\"}})\n```\n\nThere are a few limitations that can't be changed:\n\n1. Nested capturing groups are ignored; only the outermost groups become\na placeholder. So in `1(\\d+([a-z]+))3` there is only one placeholder\nalthough there are two capturing groups: re.Revert(url.Values{\"\": {\"2\", \"a\"}})\nresults in \"123\" and not \"12a3\".\n2. Literals inside capturing groups are ignored; the whole group becomes\na placeholder.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgorilla%2Freverse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgorilla%2Freverse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgorilla%2Freverse/lists"}