{"id":17383516,"url":"https://github.com/alexst07/glob-cpp","last_synced_at":"2025-04-15T09:53:05.663Z","repository":{"id":55151977,"uuid":"179603362","full_name":"alexst07/glob-cpp","owner":"alexst07","description":"Extended globbing in modern C++","archived":false,"fork":false,"pushed_at":"2023-10-18T17:57:50.000Z","size":69,"stargazers_count":9,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T19:07:26.842Z","etag":null,"topics":["cpp-library","filesystem","glob","glob-pattern","shell"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexst07.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}},"created_at":"2019-04-05T01:40:36.000Z","updated_at":"2024-07-20T14:07:20.000Z","dependencies_parsed_at":"2022-08-14T13:31:46.538Z","dependency_job_id":null,"html_url":"https://github.com/alexst07/glob-cpp","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/alexst07%2Fglob-cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexst07%2Fglob-cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexst07%2Fglob-cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexst07%2Fglob-cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexst07","download_url":"https://codeload.github.com/alexst07/glob-cpp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249048713,"owners_count":21204306,"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":["cpp-library","filesystem","glob","glob-pattern","shell"],"created_at":"2024-10-16T07:43:01.178Z","updated_at":"2025-04-15T09:53:05.645Z","avatar_url":"https://github.com/alexst07.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# glob-cpp\n------------\nGlob CPP is still in development, and more testing needs to be done.\n------------\n\nGlob CPP is a header only library based on STL regular expression to perform glob operation on string, or on filesystem.\n\n```\n?(pattern-list)   Matches zero or one occurrence of the given patterns\n*(pattern-list)   Matches zero or more occurrences of the given patterns\n+(pattern-list)   Matches one or more occurrences of the given patterns\n@(pattern-list)   Matches one of the given patterns\n!(pattern-list)   Matches anything except one of the given patterns\n```\n## Glob Examples\n```\n*.jpg         : All JPEG files\n[A-Z]*.jpg    : JPEG files that start with a capital letter\n*!(.jpg|.gif) : All files, except JPEGs or GIFs.\n```\n\n## Examples\n### Match with string\nVerify is a given string match with glob expression.\n```cpp\n#include \"glob.h\"\n\nint main () {\n  glob::glob g(\"*.pdf\");\n  bool r = glob::glob_match(\"test.pdf\", g);\n  std::cout \u003c\u003c \"match: \" \u003c\u003c r?\"yes\":\"no\" \u003c\u003c \"\\n\";\n  return 0;\n}\n```\n\n### Get match substrings\nPrint the matches found on the target sequence of characters after a glob matching operation.\n```cpp\n#include \"glob.h\"\n\nint main () {\n  glob::glob g(\"*.pdf\");\n  glob::cmatch m;\n  if (glob::glob_match(\"test.pdf\", m, g)) {\n    for (auto\u0026 token : m) {\n      std::cout \u003c\u003c \"sub string: \" \u003c\u003c token \u003c\u003c \"\\n\";\n    }\n  }\n  \n  return 0;\n}\n```\n\n### Get files from match operation in a directory and all match substrings\nGiven a directory, this example list all files that match with the glob expression. For example:\n`*.pdf` get all pdf files in the directory, and `**/*.pdf` get all pdf files in all sub directories.\n\n```cpp\n#include \"file-glob.h\"\n\nint main () {\n  glob::file_glob\u003cchar\u003e fglob{argv[1]};\n  std::vector\u003cpath_match\u003e results = fglob.Exec();\n\n  for (auto\u0026 res : results) {\n    std::cout \u003c\u003c \"path: \" \u003c\u003c  res.path() \u003c\u003c \"[\";\n    auto\u0026 match_res = res.match_result();\n    for (auto\u0026 token : match_res) {\n      std::cout \u003c\u003c \" \\\"\" \u003c\u003c token \u003c\u003c \"\\\" \";\n    }\n    std::cout \u003c\u003c \"]\" \u003c\u003c std::endl;\n  }\n  \n  return 0;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexst07%2Fglob-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexst07%2Fglob-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexst07%2Fglob-cpp/lists"}