{"id":21315546,"url":"https://github.com/retrodev256/stupid-regex","last_synced_at":"2025-10-06T02:47:18.830Z","repository":{"id":263339883,"uuid":"890073586","full_name":"RetroDev256/stupid-regex","owner":"RetroDev256","description":"Super simple regex matcher which supports . ^ $ * and any literal character","archived":false,"fork":false,"pushed_at":"2024-11-18T01:29:53.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-22T10:33:06.303Z","etag":null,"topics":["zig-library"],"latest_commit_sha":null,"homepage":"","language":"Zig","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/RetroDev256.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":"2024-11-17T23:40:37.000Z","updated_at":"2024-11-18T01:29:56.000Z","dependencies_parsed_at":"2024-11-18T01:45:09.034Z","dependency_job_id":null,"html_url":"https://github.com/RetroDev256/stupid-regex","commit_stats":null,"previous_names":["retrodev256/stupid-regex"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RetroDev256%2Fstupid-regex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RetroDev256%2Fstupid-regex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RetroDev256%2Fstupid-regex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RetroDev256%2Fstupid-regex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RetroDev256","download_url":"https://codeload.github.com/RetroDev256/stupid-regex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243791720,"owners_count":20348503,"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":["zig-library"],"created_at":"2024-11-21T18:22:45.251Z","updated_at":"2025-10-06T02:47:13.808Z","avatar_url":"https://github.com/RetroDev256.png","language":"Zig","readme":"# stupid-regex\n\n*stupid-regex* is a zig package that exposes a module named \"stupid-regex\".\nThe package contains a really simple regular expression parser, based off of\n\u003chttps://www.cs.princeton.edu/courses/archive/spr09/cos333/beautiful.html\u003e.\n\nThe parser handles these constructs:\n```\n    c    matches any literal character c\n    .    matches any single character\n    ^    matches the beginning of the input string\n    $    matches the end of the input string\n    *    matches zero or more occurrences of the previous character\n```\n\nThis is the interface for the parser:\n```zig\npub const Match = struct { start: usize, len: usize };\npub fn match(regexp: []const u8, text: []const u8) ?Match { ... }\n```\n\nThis is an example of how you could use the parser:\n```zig\ntest \"stupid-match sanity\" {\n    try expectEqual(Match{ .start = 0, .len = 0 }, match(\"\", \"Hello\"));\n    try expectEqual(Match{ .start = 1, .len = 1 }, match(\"e\", \"Hello\"));\n    try expectEqual(Match{ .start = 2, .len = 3 }, match(\"l*o\", \"Hello\"));\n    try expectEqual(Match{ .start = 1, .len = 3 }, match(\"e.l\", \"Hello\"));\n    try expectEqual(Match{ .start = 0, .len = 2 }, match(\"^.*e\", \"Hello\"));\n\n    try expectEqual(null, match(\"a\", \"eiouy\"));\n    try expectEqual(null, match(\"^b\", \"abcdef\"));\n\n    // When not the last character, $ matches $\n    try expectEqual(Match{ .start = 0, .len = 3 }, match(\"a$e\", \"a$e\"));\n\n    // When not the first character, ^ matches ^\n    try expectEqual(Match{ .start = 0, .len = 3 }, match(\"a^e\", \"a^e\"));\n\n    // Greedy matching means * will prioritize matching zero occurances\n    try expectEqual(Match{ .start = 0, .len = 0 }, match(\".*\", \"Hello, World!\\n\"));\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fretrodev256%2Fstupid-regex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fretrodev256%2Fstupid-regex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fretrodev256%2Fstupid-regex/lists"}