{"id":15616301,"url":"https://github.com/jnylen/string-matcher","last_synced_at":"2026-01-27T22:37:16.612Z","repository":{"id":41731066,"uuid":"238262965","full_name":"jnylen/string-matcher","owner":"jnylen","description":"An Elixir Library to run several regular expressions on a string and get values back.","archived":false,"fork":false,"pushed_at":"2023-08-28T04:37:00.000Z","size":27,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-27T02:02:09.060Z","etag":null,"topics":["elixir","elixir-lang","elixir-library","regex","regular-expression","string-matching","string-parsing"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":false,"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/jnylen.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":"2020-02-04T17:21:53.000Z","updated_at":"2022-01-05T13:27:26.000Z","dependencies_parsed_at":"2024-10-22T18:28:30.820Z","dependency_job_id":null,"html_url":"https://github.com/jnylen/string-matcher","commit_stats":{"total_commits":25,"total_committers":5,"mean_commits":5.0,"dds":0.64,"last_synced_commit":"ebc220a4fe9b46755e81823363538e62d8be967d"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/jnylen/string-matcher","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jnylen%2Fstring-matcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jnylen%2Fstring-matcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jnylen%2Fstring-matcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jnylen%2Fstring-matcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jnylen","download_url":"https://codeload.github.com/jnylen/string-matcher/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jnylen%2Fstring-matcher/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28824998,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T18:44:20.126Z","status":"ssl_error","status_checked_at":"2026-01-27T18:44:09.161Z","response_time":168,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["elixir","elixir-lang","elixir-library","regex","regular-expression","string-matching","string-parsing"],"created_at":"2024-10-03T07:06:04.348Z","updated_at":"2026-01-27T22:37:16.596Z","avatar_url":"https://github.com/jnylen.png","language":"Elixir","readme":"# StringMatcher\n\nThis library allows you to pass multiple regular expressions and a string and get values back.\n\n## Example\n\nLet's say you have a text that is:\n\n```\nDel 5 av 6. Shakespeare är mycket nöjd med sin senaste pjäs, Så tuktas en argbigga. Men av någon anledning uppskattas inte berättelsen om hur en stark kvinna förnedras av en man av kvinnorna i Shakespeares närhet.\n\nOriginaltitel: Upstart Crow.\nProduktion: BBC 2017.\n```\n\nFirst we would split the text into an array based on `\\n` and `.` so that we can loop over the long text, as our matches only returns the first match back.\n\nThen you would do:\n\n```elixir\nStringMatcher.new()\n|\u003e StringMatcher.add_regexp(\n  ~r/Del\\s+(?\u003cepisode_num\u003e[0-9]+?)\\s+av\\s+(?\u003cof_episodes\u003e[0-9]+?)/i,\n  %{}\n)\n|\u003e StringMatcher.add_regexp(~r/Originaltitel: (?\u003coriginal_title\u003e.*)\\./i, %{})\n|\u003e StringMatcher.add_regexp(\n  ~r/Produktion: (?\u003cproduction_company\u003e.*?) (?\u003cproduction_year\u003e[0-9]+)\\./i,\n  %{}\n)\n|\u003e StringMatcher.match_captures(string)\n```\n\nThis should return a tuple with a map. The map is returned value of the regular expressions.\nIf no match is found you will receive `{:error, \"no match\"}`\n\n## Installation\n\nIf [available in Hex](https://hex.pm/docs/publish), the package can be installed\nby adding `string_matcher` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:string_matcher, \"~\u003e 0.1.0\"}\n  ]\nend\n```\n\nDocumentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)\nand published on [HexDocs](https://hexdocs.pm). Once published, the docs can\nbe found at [https://hexdocs.pm/string_matcher](https://hexdocs.pm/string_matcher).\n\n## Tests\n\nCurrently the tests are failing for some reason, the library is working though and is stable.\nIt's used in production.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjnylen%2Fstring-matcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjnylen%2Fstring-matcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjnylen%2Fstring-matcher/lists"}