{"id":18909139,"url":"https://github.com/jruby/joni","last_synced_at":"2025-05-14T05:10:40.073Z","repository":{"id":691143,"uuid":"335342","full_name":"jruby/joni","owner":"jruby","description":"Java port of Oniguruma regexp library","archived":false,"fork":false,"pushed_at":"2025-03-28T21:54:38.000Z","size":1513,"stargazers_count":172,"open_issues_count":13,"forks_count":92,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-12T22:16:48.743Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","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/jruby.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":"2009-10-12T21:15:07.000Z","updated_at":"2025-03-30T08:07:20.000Z","dependencies_parsed_at":"2025-01-24T20:00:42.497Z","dependency_job_id":"4658a641-40a3-4687-9c9f-85c345e0dde0","html_url":"https://github.com/jruby/joni","commit_stats":{"total_commits":632,"total_committers":22,"mean_commits":"28.727272727272727","dds":"0.29430379746835444","last_synced_commit":"92292ed34f66500b87504c43babd8cb4a72a54c1"},"previous_names":[],"tags_count":70,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jruby%2Fjoni","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jruby%2Fjoni/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jruby%2Fjoni/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jruby%2Fjoni/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jruby","download_url":"https://codeload.github.com/jruby/joni/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254076850,"owners_count":22010611,"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":[],"created_at":"2024-11-08T09:31:11.129Z","updated_at":"2025-05-14T05:10:40.045Z","avatar_url":"https://github.com/jruby.png","language":"Java","readme":"joni\n====\n\n[![Maven Central](https://img.shields.io/maven-central/v/org.jruby.joni/joni)](https://central.sonatype.com/artifact/org.jruby.joni/joni)\n[![Build Status](https://github.com/jruby/joni/actions/workflows/maven.yml/badge.svg)](https://github.com/jruby/joni/actions/workflows/maven.yml)\n\nJava port of [Oniguruma](https://github.com/kkos/oniguruma) regexp library\n\n## Usage\n\n### Imports\n\n```java\nimport org.jcodings.specific.UTF8Encoding;\nimport org.joni.Matcher;\nimport org.joni.Option;\nimport org.joni.Regex;\n```\n\n### Matching\n\n```java\nbyte[] pattern = \"a*\".getBytes();\nbyte[] str = \"aaa\".getBytes();\n\nRegex regex = new Regex(pattern, 0, pattern.length, Option.NONE, UTF8Encoding.INSTANCE);\nMatcher matcher = regex.matcher(str);\nint result = matcher.search(0, str.length, Option.DEFAULT);\n```\n\n### Using captures\n\n```java\nbyte[] pattern = \"(a*)\".getBytes();\nbyte[] str = \"aaa\".getBytes();\n\nRegex regex = new Regex(pattern, 0, pattern.length, Option.NONE, UTF8Encoding.INSTANCE);\nMatcher matcher = regex.matcher(str);\nint result = matcher.search(0, str.length, Option.DEFAULT);\nif (result != -1) {\n    Region region = matcher.getEagerRegion();\n}\n```\n\n### Using named captures\n\n```java\nbyte[] pattern = \"(?\u003cname\u003ea*)\".getBytes();\nbyte[] str = \"aaa\".getBytes();\n\nRegex regex = new Regex(pattern, 0, pattern.length, Option.NONE, UTF8Encoding.INSTANCE);\nMatcher matcher = regex.matcher(str);\nint result = matcher.search(0, str.length, Option.DEFAULT);\nif (result != -1) {\n    Region region = matcher.getEagerRegion();\n    for (Iterator\u003cNameEntry\u003e entry = regex.namedBackrefIterator(); entry.hasNext();) {\n        NameEntry e = entry.next();\n        int number = e.getBackRefs()[0]; // can have many refs per name\n        // int begin = region.beg[number];\n        // int end = region.end[number];\n    }\n}\n```\n\n## License\n\nJoni is released under the [MIT License](http://www.opensource.org/licenses/MIT).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjruby%2Fjoni","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjruby%2Fjoni","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjruby%2Fjoni/lists"}