{"id":42524116,"url":"https://github.com/sisyphsu/retree-java","last_synced_at":"2026-01-28T15:36:30.232Z","repository":{"id":57722840,"uuid":"206696671","full_name":"sisyphsu/retree-java","owner":"sisyphsu","description":"retree is regular-expression-tree, which supports quickly and concurrently matching of lots of regex patterns.","archived":false,"fork":false,"pushed_at":"2019-09-17T13:30:14.000Z","size":185,"stargazers_count":10,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-13T03:45:07.770Z","etag":null,"topics":["concurrency-patterns","regular-expression-engine","regular-expressions","regular-expresssion-tool"],"latest_commit_sha":null,"homepage":"","language":"Java","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/sisyphsu.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-09-06T02:29:30.000Z","updated_at":"2022-09-12T22:12:30.000Z","dependencies_parsed_at":"2022-09-26T21:50:14.134Z","dependency_job_id":null,"html_url":"https://github.com/sisyphsu/retree-java","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sisyphsu/retree-java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sisyphsu%2Fretree-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sisyphsu%2Fretree-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sisyphsu%2Fretree-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sisyphsu%2Fretree-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sisyphsu","download_url":"https://codeload.github.com/sisyphsu/retree-java/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sisyphsu%2Fretree-java/sbom","scorecard":{"id":827969,"data":{"date":"2025-08-11","repo":{"name":"github.com/sisyphsu/retree-java","commit":"fcb340808104970ed0f2e6ae098513b3be022880"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T16:59:21.793Z","repository_id":57722840,"created_at":"2025-08-23T16:59:21.793Z","updated_at":"2025-08-23T16:59:21.793Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28846374,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T15:15:36.453Z","status":"ssl_error","status_checked_at":"2026-01-28T15:15:13.020Z","response_time":57,"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":["concurrency-patterns","regular-expression-engine","regular-expressions","regular-expresssion-tool"],"created_at":"2026-01-28T15:36:29.386Z","updated_at":"2026-01-28T15:36:30.223Z","avatar_url":"https://github.com/sisyphsu.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# retree-java\n\n[![Travis CI](https://travis-ci.org/sisyphsu/retree-java.svg?branch=master)](https://travis-ci.org/sisyphsu/retree-java)\n[![codecov](https://codecov.io/gh/sisyphsu/retree-java/branch/master/graph/badge.svg)](https://codecov.io/gh/sisyphsu/retree-java)\n\n# Introduce\n\n`retree` could parse and combine lots of regular expressions as an `regular-expression-tree`, \nwhich is very similar to `trie`.\n\nFirst, `retree` would parse `regex` as a **node-chain**, for example:\n+ `\\d+a\\W` will be parsed as `CurlyNode(\\d+) -\u003e CharNode(a) -\u003e CharNode(\\W)`,\n+ `\\d+\\s\\W` will be parsed as `CurlyNode(\\d+) -\u003e CharNode(\\s) -\u003e CharNode(\\W)`.\n \nAfter that, `retree` will merge those two **node-chain** as one **node-tree** \n(there should have an image to explain how it looks)\n\nWhen performing multiple regex matching, we could use `retree` to reduce useless scan and loop, and avoid lots of backtracking.\n\n# Maven Dependency\n\nAdd maven dependency:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.sisyphsu\u003c/groupId\u003e\n    \u003cartifactId\u003eretree\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.4\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n# Usage\n\nThis example shows how `retree` works, it's very similar to `java.util.regex`:\n\n```java\nString[] res = {\"(\\\\d{4}-\\\\d{1,2}-\\\\d{1,2})\", \"\u003cb\u003e(?\u003cname\u003e.*)\u003c/b\u003e\", \"(\\\\w+@\\\\w+\\\\.[a-z]+(\\\\.[a-z]+)?)\"};\nString input = \"Today is 2019-09-05, from \u003cb\u003esulin\u003c/b\u003e (sisyphsu@gmail.com).\";\nReMatcher matcher = new ReMatcher(new ReTree(res), input);\n\nassert matcher.find();\nassert \"2019-09-05\".contentEquals(matcher.group());\n\nassert matcher.find();\nassert \"\u003cb\u003esulin\u003c/b\u003e\".contentEquals(matcher.group());\nassert \"sulin\".contentEquals(matcher.group(\"name\"));\n\nassert matcher.find();\nassert \"sisyphsu@gmail.com\".contentEquals(matcher.group());\n```\n\nIn this example, we only need to scan `input` once to complete three different regular expressions' matching: \n+ `(\\d{4}-\\d{1,2}-\\d{1,2})`\n+ `\u003cb\u003e(?\u003cname\u003e.*)\u003c/b\u003e`\n+ `(\\\\w+@\\\\w+\\\\.[a-z]+(\\\\.[a-z]+)?)` \n\n# Showcase\n\n[**dateparser**](https://github.com/sisyphsu/dateparser)\n\n`dateparser` is a smart and high-performance date parser library, \nit supports hundreds of different format, nearly all format that we used.\n\n`dateparser` use `retree` to perform the matching operation of lots of different date patterns. \n\nEven if `dateparser` have thundreds of predefined regular expressions, \nit still can parse date very fast(1000~1500ns).\n\n# Performance \u0026 Benchmark\n\nTODO\n\n# Multi-Language Support\n\nI will transplant this library to `golang` and `javascript` in nearly future.\n\n# License\n\nApache-2.0","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsisyphsu%2Fretree-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsisyphsu%2Fretree-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsisyphsu%2Fretree-java/lists"}