{"id":16641831,"url":"https://github.com/samthor/sre2","last_synced_at":"2025-10-30T11:31:21.715Z","repository":{"id":66115185,"uuid":"43361031","full_name":"samthor/sre2","owner":"samthor","description":"non-standard implementation of RE2 in Go","archived":false,"fork":false,"pushed_at":"2015-09-29T10:40:56.000Z","size":280,"stargazers_count":17,"open_issues_count":2,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-02T08:11:21.729Z","etag":null,"topics":["golang","re2"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samthor.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}},"created_at":"2015-09-29T10:30:08.000Z","updated_at":"2023-08-03T16:34:48.000Z","dependencies_parsed_at":"2023-02-19T22:45:31.893Z","dependency_job_id":null,"html_url":"https://github.com/samthor/sre2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samthor%2Fsre2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samthor%2Fsre2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samthor%2Fsre2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samthor%2Fsre2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samthor","download_url":"https://codeload.github.com/samthor/sre2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238960272,"owners_count":19559233,"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":["golang","re2"],"created_at":"2024-10-12T07:48:01.769Z","updated_at":"2025-10-30T11:31:15.406Z","avatar_url":"https://github.com/samthor.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sre2\n\nImplementation of [RE2](https://github.com/google/re2), done natively in Go. Not related to the native implementation. Handles pathological cases with style and does not backtrack.\n\nThere are two available matchers: a fast matcher that does not attempt to track submatches, and a slower matcher that does. Internally, sre2 acts only on runes, not bytes; thus, the only missing part of syntax is `\\C` (consume a single byte, even in UTF-8 mode).\n\nThe code provides a small library with small suite of tests. The package also includes a tiny main test binary, mostly useful for simple tests and for speed comparisons versus the standard regexp module.\n\nThis project was previously hosted on [Google Code](https://code.google.com/p/sre2/).\n\n## Usage\n\n```go\n// MustParse will panic on compile failure; useful for init()\nm := sre2.MustParse(re)\nm, err := sre2.Parse(re)\n\n// Simpler matcher just returns true/false\nmatch := m.Match(str)\n\n// Complex matcher returns indexes of found result: match n will be between (n*2,(n*2)+1).\n// The 0th match is reserved for the complete found string. On failure, will return nil.\nindex := m.MatchIndex(str)\n\n// After this example, fooidx will equal: {3, 12, 3, 6, 7, 12}\nfoo := sre2.MustParse(`(foo+|bar)\\w(.*)`)\nfooidx := m.MatchIndex(\"hi fooo test\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamthor%2Fsre2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamthor%2Fsre2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamthor%2Fsre2/lists"}