{"id":20550247,"url":"https://github.com/dnmfarrell/prolog-pattern-match","last_synced_at":"2026-02-04T03:34:31.653Z","repository":{"id":184427367,"uuid":"671668934","full_name":"dnmfarrell/prolog-pattern-match","owner":"dnmfarrell","description":"A Definite Clause Grammar to match strings to string patterns, with * as a wildcard.","archived":false,"fork":false,"pushed_at":"2023-08-03T13:23:20.000Z","size":3,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-16T16:49:23.809Z","etag":null,"topics":["dcg","pattern-matching","prolog"],"latest_commit_sha":null,"homepage":"","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":"2023-07-27T21:28:44.000Z","updated_at":"2024-07-11T15:03:10.000Z","dependencies_parsed_at":"2024-11-16T02:24:24.538Z","dependency_job_id":"5844ebdf-e9b1-4f72-a864-478dcf385598","html_url":"https://github.com/dnmfarrell/prolog-pattern-match","commit_stats":null,"previous_names":["dnmfarrell/prolog-pattern-match"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnmfarrell%2Fprolog-pattern-match","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnmfarrell%2Fprolog-pattern-match/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnmfarrell%2Fprolog-pattern-match/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnmfarrell%2Fprolog-pattern-match/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dnmfarrell","download_url":"https://codeload.github.com/dnmfarrell/prolog-pattern-match/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242157180,"owners_count":20081036,"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":["dcg","pattern-matching","prolog"],"created_at":"2024-11-16T02:24:06.042Z","updated_at":"2026-02-04T03:34:26.625Z","avatar_url":"https://github.com/dnmfarrell.png","language":"Prolog","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Prolog Pattern Match\nA Definite Clause Grammar to match strings to string patterns, with `*` as a wildcard.\n\n### Rules\nA pattern is a list of printable characters. The asterisk character is a wildcard which matches one or more characters (not zero like with a glob or regex).\n\n### Examples\n\n    ?- % only an empty list matches an empty list\n    phrase(patt(C),\"\").\n       C = []\n    ;  false.\n    ?- % wildcard matches one or more characters\n    phrase(patt(C),\"fo\").\n       C = \"fo\"\n    ;  C = \"f*\"\n    ;  C = \"*\"\n    ;  C = \"*o\"\n    ;  false.\n    ?- % test a pattern against a string\n    phrase(patt(\"foo*\"),\"foo/bar\").\n       true\n    ;  false.\n    ?- % generate patterns to match two strings\n    phrase(patt(C),\"/bin/bash\"), phrase(patt(C), \"/bin/sh\").\n       C = \"/bin/*\"\n    ;  C = \"/bin/*h\"\n    ;  C = \"/bin*\"\n    ;  C = \"/bin*h\"\n    ;  C = \"/bin*sh\"\n    ;  ...\n    ;  false.\n\n### Usage\n\nTested with Trealla and SWI-Prolog. Doesn't work on Scryer Prolog.\n\nWith SWI-Prolog, set the `double_quotes` flag to `chars` to make the examples work.\n\n    ?- set_prolog_flag(double_quotes, chars).\n\n### MIT License\n\nCopyright (c) 2023 David Farrell\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdnmfarrell%2Fprolog-pattern-match","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdnmfarrell%2Fprolog-pattern-match","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdnmfarrell%2Fprolog-pattern-match/lists"}