{"id":9528805,"url":"https://github.com/MahBestBro/regex","last_synced_at":"2025-08-23T10:32:01.545Z","repository":{"id":239502812,"uuid":"615895811","full_name":"MahBestBro/regex","owner":"MahBestBro","description":"A single file regex library written in and for Zig. ","archived":false,"fork":false,"pushed_at":"2023-04-12T03:47:50.000Z","size":110,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-21T07:31:58.234Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MahBestBro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-03-19T01:40:23.000Z","updated_at":"2024-11-25T23:07:06.000Z","dependencies_parsed_at":"2024-05-13T00:07:38.765Z","dependency_job_id":"abee9281-74ed-43eb-9510-4931cb4ed20d","html_url":"https://github.com/MahBestBro/regex","commit_stats":null,"previous_names":["mahbestbro/regex"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MahBestBro/regex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MahBestBro%2Fregex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MahBestBro%2Fregex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MahBestBro%2Fregex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MahBestBro%2Fregex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MahBestBro","download_url":"https://codeload.github.com/MahBestBro/regex/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MahBestBro%2Fregex/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271746655,"owners_count":24813575,"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-08-23T02:00:09.327Z","response_time":69,"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":[],"created_at":"2024-05-12T23:11:12.758Z","updated_at":"2025-08-23T10:31:59.500Z","avatar_url":"https://github.com/MahBestBro.png","language":"Zig","readme":"# zig-regex\n A single file regex library written in and for Zig.\n\n **Note:** This library is still in development.  For now I would recommend using another library if you are looking for something robust.  \n \n This library was mainly inspired by the rough implementation of Ken Thompson's algorithm outlined in [this article](https://swtch.com/~rsc/regexp/regexp1.html) by Russ Cox, though not everything is based off it.\n\n## Getting Started\n Just download the `regex.zig` file and include it into your project however you want.  \n\n## Example Usage\n```zig\nconst std = @import(\"std\");\nconst regex = @import(\"regex.zig\");\n\npub fn main() !void\n{\n    var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);\n    defer arena.deinit();\n\n    const rx = try regex.Regex.compile(\"ab*c\", arena.allocator());\n    defer rx.deinit();\n    \n    if (rx.match(\"abc\")) \n    {\n        std.debug.print(\"Hooray!\\n\", .{});\n    } \n    else \n    {\n        std.debug.print(\"Uh oh...\\n\", .{});\n    }\n}\n```\n\n## Notation\n Like all regular expressions, non-operator characters which are next to each other concatenate (so `abc` would match \"abc\"). Brackets are denoted by normal parenthesis (i.e., `()`).\n\n The following regex operators are supported as of current:\n * `|` - If `R` and `S` are regular expressions, then `R|S` matches `R` or `S` (Note: This has the highest precedence, so `a|bc*` is equivalent to `a|(bc*)`, not `(a|b)c*`).\n * `*` - If `R` is a regular expression, then `R*` matches 0 or more repetitions of `R`.\n * `+` - Same as `*` but 1 or more repetitions.\n * `?` - If `R` is a regular expression, then `R?` matches 1 or no appearances if `R`\n\n The following character classes are supported as of current\n * `.` - represents any character.\n * `[]` - represents any of the characters inside these brackets (e.g., `[abc]` would mean 'a', 'b' or 'c').\n  * `-` - use inside square brackets to denote a range of characters (e.g., `[a-z]` would mean any character from 'a' to 'z').\n\n `/` is an escape character, it can be used to escape any character that would normally represent an operator or character class* (e.g., `/*` would match \"*\"), and can also represent the following control codes:\n * `/n` - recognises new line ascii character.\n * `/r` - recognises return carriage ascii character.\n * `/t` - recognises tab ascii character.\n\n *Note: What requires escaping depends one whether you're inside `[]` or not. For example,\n `*` does not need escaping when inside `[]`, but `-` does.\n\n## Features to be added\n * Substring matching\n\n## Potential future features\n * Subexpressions (probably with `{}`).\n * UTF8 support\n * Any other operators I can think of or remember that are commonly used or are useful.\n","funding_links":[],"categories":["Language Essentials"],"sub_categories":["File Format Processing"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMahBestBro%2Fregex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMahBestBro%2Fregex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMahBestBro%2Fregex/lists"}