{"id":20550154,"url":"https://github.com/dnmfarrell/wildcard","last_synced_at":"2026-03-06T18:47:00.282Z","repository":{"id":258457898,"uuid":"873875336","full_name":"dnmfarrell/wildcard","owner":"dnmfarrell","description":"Prolog DCG to match string patterns","archived":false,"fork":false,"pushed_at":"2025-01-31T22:01:32.000Z","size":8,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-06T05:43:32.437Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Prolog","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/dnmfarrell.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}},"created_at":"2024-10-16T21:45:03.000Z","updated_at":"2025-01-31T22:01:35.000Z","dependencies_parsed_at":"2024-10-20T10:51:17.715Z","dependency_job_id":null,"html_url":"https://github.com/dnmfarrell/wildcard","commit_stats":null,"previous_names":["dnmfarrell/wildcard"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dnmfarrell/wildcard","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnmfarrell%2Fwildcard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnmfarrell%2Fwildcard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnmfarrell%2Fwildcard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnmfarrell%2Fwildcard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dnmfarrell","download_url":"https://codeload.github.com/dnmfarrell/wildcard/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnmfarrell%2Fwildcard/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30191563,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T18:45:49.703Z","status":"ssl_error","status_checked_at":"2026-03-06T18:45:46.406Z","response_time":250,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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-11-16T02:23:35.680Z","updated_at":"2026-03-06T18:47:00.263Z","avatar_url":"https://github.com/dnmfarrell.png","language":"Prolog","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wildcard\n\nProlog DCG to match string patterns. Supports:\n\n- `*` wildcard: matches any pattern including the empty string.\n- `?` placeholder: matches any single atom.\n- `\\` escape: turns `*`, `?` and `\\` into literal tokens.\n\nN.B. this module intentionally does not verify its arguments are strings - additional clauses can be added to restrict the generated characters (examples below).\n\nRequires [Scryer-Prolog](https://www.scryer.pl/) or similar interpreter.\n\n## Usage\n\nExports `patt//1` which matches a string pattern to a string:\n\n    $ scryer-prolog src/wildcard.pl\n    ?- phrase(patt(\"1?3\"), \"123\").\n       true.\n    ?- phrase(patt(\"*\"), \"123\").\n       true.\n    ?- phrase(patt(\"***\"), \"123\").\n       true.\n    ?- phrase(patt(\"???\"), \"123\").\n       true.\n    ?- phrase(patt(\"?*?\"), \"123\").\n       true.\n\nWildcard can also generate strings for given pattern, with a helper predicate to restrict the generated characters:\n\n    ?- [user].\n    uc_char(Char) :- member(Char, \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\").\n    \n    ?- phrase(patt(\"D?G\"), Cs), maplist(uc_char, Cs).\n       Cs = \"DAG\"\n    ;  Cs = \"DBG\"\n    ;  Cs = \"DCG\"\n    ;  Cs = \"DDG\"\n    ;  ... .\n\nLimit the search space for wildcard patterns by length:\n\n    ?- length(Cs, 4), phrase(patt(\"D*G\"), Cs), maplist(uc_char, Cs).\n       Cs = \"DAAG\"\n    ;  Cs = \"DABG\"\n    ;  Cs = \"DACG\"\n    ;  Cs = \"DADG\"\n    ;  Cs = \"DAEG\"\n    ;  ... .\n\n## Testing\n\n    $ scryer-prolog -f test/wildcard.pl\n    Running test \"a-ab\"\n    Running test \"A-a\"\n    Running test \"aB-ab\"\n    Running test \"abC-abc\"\n    Running test \"a-a\"\n    Running test \"ab-ab\"\n    Running test \"?a-a\"\n    Running test \"a?-a\"\n    Running test \"?-a\"\n    Running test \"a?-ab\"\n    Running test \"a?c-abc\"\n    Running test \"???-abc\"\n    Running test \"*a-a\"\n    Running test \"a*-a\"\n    Running test \"*-a\"\n    Running test \"a*-ab\"\n    Running test \"a*c-abc\"\n    Running test \"*-abc\"\n    Running test \"***-abc\"\n    Running test \"*?-a\"\n    Running test \"*?*-a\"\n    Running test \"?*?-ab\"\n    Running test \"?*?-abc\"\n    Running test \"?*-abcde\"\n    Running test \"?*-a\"\n    Running test \"\\?-?\"\n    Running test \"\\?\\?-??\"\n    Running test \"\\*-*\"\n    Running test \"\\*\\*-**\"\n    Running test \"\\A-A\"\n    Running test \"\\A-\\A\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdnmfarrell%2Fwildcard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdnmfarrell%2Fwildcard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdnmfarrell%2Fwildcard/lists"}