{"id":21981702,"url":"https://github.com/soft/bash-match","last_synced_at":"2026-05-07T06:34:51.852Z","repository":{"id":66599648,"uuid":"117091093","full_name":"Soft/bash-match","owner":"Soft","description":"Perl style regex matching for Bash","archived":false,"fork":false,"pushed_at":"2018-01-11T11:26:14.000Z","size":14,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-28T04:29:11.668Z","etag":null,"topics":["bash","plugin","regex","regular-expressions","shell","shell-scripting"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Soft.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":"COPYING","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":"2018-01-11T11:25:58.000Z","updated_at":"2021-05-23T17:28:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"525a3408-eee9-41e5-af2f-a6ed427499c1","html_url":"https://github.com/Soft/bash-match","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Soft%2Fbash-match","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Soft%2Fbash-match/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Soft%2Fbash-match/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Soft%2Fbash-match/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Soft","download_url":"https://codeload.github.com/Soft/bash-match/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245040911,"owners_count":20551335,"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":["bash","plugin","regex","regular-expressions","shell","shell-scripting"],"created_at":"2024-11-29T17:19:12.864Z","updated_at":"2026-05-07T06:34:46.816Z","avatar_url":"https://github.com/Soft.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Matching for Bash\n\n`bash-match` is an experimental loadable for\n[Bash](https://www.gnu.org/software/bash/), that aims to make working with text\na joy. It enhances Bash with a single new built-in `match`.\n\n\tmatch pattern string [name ...]\n\n## Usage\n\n`match` can check if a string matches a pattern:\n\n\tmatch 'Hello World' 'Hello World'\n\techo $?\n\t=\u003e 0\n\t\n\tmatch 'Foo' 'Bar'\n\techo $?\n\t=\u003e 1\n\t\n\tmatch '^(allow|deny) \\d{1,3}$' 'allow 42'\n\techo $?\n\t=\u003e 0\n\t\nThis can be, for example, combined with the `if` construct, but admittedly\noffers little over the natively supported `=~` comparison operator. Where\n`match` shines is capturing:\n\n\tmatch 'entry-(\\d+)' 'foo entry-42 bar' full id\n\techo $?\n\t=\u003e 0\n\techo \"$full\"\n\t=\u003e entry-42\n\techo \"$id\"\n\t=\u003e 42\n\t\n`match` assigns the results of captures to the variables passed to it. The first\nvariable will contain the entire match.\n\n\tdeclare -a results\n\tmatch '\\d{3}-\\d{3}-\\d{3}' '100-200-300' results\n\techo \"${results[0]}\"\n\t=\u003e 100-200-300\n\techo \"${results[1]}\"\n\t=\u003e 100\n\techo \"${results[2]}\"\n\t=\u003e 200\n\techo \"${results[3]}\"\n\t=\u003e 300\n\nIf the variable has been previously declared as an array, it will be used to\nstore the captures.\n\t\n## Installation\n\n## Copying\n\n`bash-match` is licensed under the GNU General Public License Version 3.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoft%2Fbash-match","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoft%2Fbash-match","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoft%2Fbash-match/lists"}