{"id":28964519,"url":"https://github.com/beariish/picomatch","last_synced_at":"2025-06-25T06:01:40.791Z","repository":{"id":300495384,"uuid":"1004450940","full_name":"Beariish/picomatch","owner":"Beariish","description":"A tiny implementation of a sensible regex subset ","archived":false,"fork":false,"pushed_at":"2025-06-22T01:53:45.000Z","size":8,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-22T02:42:32.159Z","etag":null,"topics":["c","library","regex","regex-engine"],"latest_commit_sha":null,"homepage":"","language":"C","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/Beariish.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,"zenodo":null}},"created_at":"2025-06-18T16:34:44.000Z","updated_at":"2025-06-22T01:53:47.000Z","dependencies_parsed_at":"2025-06-22T02:52:37.009Z","dependency_job_id":null,"html_url":"https://github.com/Beariish/picomatch","commit_stats":null,"previous_names":["beariish/picomatch"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Beariish/picomatch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Beariish%2Fpicomatch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Beariish%2Fpicomatch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Beariish%2Fpicomatch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Beariish%2Fpicomatch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Beariish","download_url":"https://codeload.github.com/Beariish/picomatch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Beariish%2Fpicomatch/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261611074,"owners_count":23184020,"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":["c","library","regex","regex-engine"],"created_at":"2025-06-24T05:06:37.798Z","updated_at":"2025-06-24T05:06:48.084Z","avatar_url":"https://github.com/Beariish.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Picomatch\r\nA tiny, sensible subset of regex.\r\n\r\n* Zero dependencies (unless you count the C standard library)\r\n* Completely cross-platform\r\n* Tiny implementation\r\n* No allocations or global state\r\n* Concise, safe API\r\n\r\npicomatch supports a wide subset of regex, including..\r\n* Anchors `^ $ \\b \\B`\r\n* Grouping and capturing `() (?:)`\r\n* Sets, including ranges `[...] [^...] [a-zA-z]`\r\n* Character classes `\\s \\S \\w \\W \\d \\D`\r\n* Escaped characters `\\n \\r \\t \\0 \\\\`\r\n* Quantifiers `+ +? * *? {1} {1,} {1,5} ?`\r\n\r\nUnlike most other small regex libraries, picomatch's quantifiers support limited backtracking as well\r\n\r\n## Usage\r\nHere's a basic example using picomatch to identify email addresses\r\n```c\r\n// capture both the name and the provider\r\nconst char* regex = \"^([\\\\w.\\\\-]{0,25})@(yahoo|hotmail|gmail)\\\\.com$\";\r\n\r\n// get the required allocation size for the compiled regex\r\n// you can skip this step if you provide a sensible allocation, \r\n// and picomatch will gracefully error if it's not enough\r\nconst char* err = NULL;\r\nsize_t compiled_size = pm_expsize(regex, \u0026err);  \r\nif (compiled_size == 0) {  \r\n    printf(\"Failed to size: %s\\n\", err);  \r\n    return 1;  \r\n}  \r\n\r\n// Compile the regex!\r\npm_Regex* expr = malloc(compiled_size);  \r\nif (!pm_compile(expr, compiled_size, regex)) {  \r\n    printf(\"Failed to compile: %s\\n\", pm_geterror(expr));  \r\n}  \r\n\r\n// Get the number of capture groups required;\r\nint num_groups = pm_getgroups(expr);\r\npm_Group* capture_groups = malloc(sizeof(pm_Group) * num_groups);  \r\nmemset(capture_groups, 0, sizeof(pm_Group) * num_groups);  \r\n  \r\nconst char* source = \"example-mail@yahoo.com\";  \r\nprintf(\"\\nMatches: %d\\n\", pm_match(expr, source, 0, capture_groups, num_groups, 0)); \r\nfor (int i = 0; i \u003c num_groups; i++) {  \r\n    printf(\"\\t%d - '%.*s'\\n\", i, capture_groups[i].length, source + capture_groups[i].start);  \r\n}\r\n\r\n// matches: 1\r\n//     0 - 'example-mail@yahoo.com'\r\n//     1 - 'example-mail'\r\n//     2 - 'yahoo'\r\n```\r\n\r\nFor more complex usage, refer to the documentation in `picomatch.h`\r\n\r\n## License\r\npicomatch is licensed under MIT, see the notice in the source files or `LICENSE` for details. ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeariish%2Fpicomatch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeariish%2Fpicomatch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeariish%2Fpicomatch/lists"}