{"id":20748962,"url":"https://github.com/rhaeguard/rgx","last_synced_at":"2025-09-27T20:31:37.213Z","repository":{"id":189585872,"uuid":"680919644","full_name":"rhaeguard/rgx","owner":"rhaeguard","description":"a tiny regex engine written in go","archived":false,"fork":false,"pushed_at":"2023-10-13T22:24:42.000Z","size":111,"stargazers_count":23,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-23T17:03:50.180Z","etag":null,"topics":["golang","regex","regex-engine","regex-util"],"latest_commit_sha":null,"homepage":"https://rhaeguard.github.io/posts/regex","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rhaeguard.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}},"created_at":"2023-08-20T20:31:40.000Z","updated_at":"2025-09-02T13:05:00.000Z","dependencies_parsed_at":"2023-10-03T12:17:17.832Z","dependency_job_id":null,"html_url":"https://github.com/rhaeguard/rgx","commit_stats":null,"previous_names":["rhaeguard/rgx"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/rhaeguard/rgx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhaeguard%2Frgx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhaeguard%2Frgx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhaeguard%2Frgx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhaeguard%2Frgx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rhaeguard","download_url":"https://codeload.github.com/rhaeguard/rgx/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhaeguard%2Frgx/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277284799,"owners_count":25792645,"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","status":"online","status_checked_at":"2025-09-27T02:00:08.978Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","regex","regex-engine","regex-util"],"created_at":"2024-11-17T08:19:47.551Z","updated_at":"2025-09-27T20:31:36.895Z","avatar_url":"https://github.com/rhaeguard.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rgx\n\n![](https://github.com/rhaeguard/rgx/actions/workflows/go.yml/badge.svg)\n\nA very simple regex engine written in go. This library is experimental, use it at your own risk!\n\nread the [article](https://rhaeguard.github.io/posts/regex).\n\n### to add the dependency:\n\n```shell\ngo get github.com/rhaeguard/rgx\n```\n\n### how to use: \n```go\nimport \"github.com/rhaeguard/rgx\"\n\npattern, err := rgx.Compile(regexString)\nif err != nil {\n\t// error handling\n}\nresults := pattern.FindMatches(content)\n\nif results.Matches {\n\tgroupMatchString := results.Groups[\"group-name\"]\n}\n```\n\n### todo\n\n- [x] `^` beginning of the string\n- [x] `$` end of the string\n- [x] `.` any single character/wildcard\n- [x] bracket notation\n  - [x] `[ ]` bracket notation/ranges\n  - [x] `[^ ]` bracket negation notation\n  - [x] better handling of the bracket expressions: e.g., `[ab-exy12]`\n  - [x] special characters in the bracket\n    - [x] support escape character\n- [x] quantifiers\n  - [x] `*` none or more times\n  - [x] `+` one or more times\n  - [x] `?` optional\n  - [x] `{m,n}` more than or equal to `m` and less than equal to `n` times\n- [x] capturing group\n  - [x] `( )` capturing group or subexpression\n  - [x] `\\n` backreference, e.g, `(dog)\\1` where `n` is in `[0, 9]`\n  - [x] `\\k\u003cname\u003e` named backreference, e.g, `(?\u003canimal\u003edog)\\k\u003canimal\u003e`\n  - [x] extracting the string that matches with the regex\n- [x] `\\` escape character\n  - [x] support special characters - context dependant\n- [x] better error handling in the API\n- [x] ability to work on multi-line strings (tested on [Alice in Wonderland](./lib_testdata) text corpus)\n  - [x] `.` should not match the newline - `\\n`\n  - [x] `$` should match the newline - `\\n`\n  - [x] multiple full matches\n\n## notes\n\n- `\\` escape turns any next character into a literal, no special combinations such as `\\d` for digits, `\\b` for backspace, etc. are allowed\n- numeric groups `\\n` only support single digit references, so `\\10` will be interpreted as the first capture group followed by a literal `0`\n\n## credits\n- [Alice in Wonderland, Lewis Carroll, Project Guttenberg](https://www.gutenberg.org/ebooks/11)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhaeguard%2Frgx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frhaeguard%2Frgx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhaeguard%2Frgx/lists"}