GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - jruby/joni: Java port of Oniguruma regexp library

BranchesTags
Open more actions menu

Latest commit

 

History

760 Commits
760 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
.mvn/wrapper
.mvn/wrapper
 
 
src
src
 
 
test/org/joni/test
test/org/joni/test
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
Jenkinsfile
Jenkinsfile
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
mvnw
mvnw
 
 
mvnw.cmd
mvnw.cmd
 
 
pom.xml
pom.xml
 
 

Repository files navigation

joni

Maven Central Build Status

Java port of Oniguruma regexp library

Usage

Imports

import org.jcodings.specific.UTF8Encoding;
import org.joni.Matcher;
import org.joni.Option;
import org.joni.Regex;

Matching

byte[] pattern = "a*".getBytes();
byte[] str = "aaa".getBytes();

Regex regex = new Regex(pattern, 0, pattern.length, Option.NONE, UTF8Encoding.INSTANCE);
Matcher matcher = regex.matcher(str);
int result = matcher.search(0, str.length, Option.DEFAULT);

Using captures

byte[] pattern = "(a*)".getBytes();
byte[] str = "aaa".getBytes();

Regex regex = new Regex(pattern, 0, pattern.length, Option.NONE, UTF8Encoding.INSTANCE);
Matcher matcher = regex.matcher(str);
int result = matcher.search(0, str.length, Option.DEFAULT);
if (result != -1) {
    Region region = matcher.getEagerRegion();
}

Using named captures

byte[] pattern = "(?<name>a*)".getBytes();
byte[] str = "aaa".getBytes();

Regex regex = new Regex(pattern, 0, pattern.length, Option.NONE, UTF8Encoding.INSTANCE);
Matcher matcher = regex.matcher(str);
int result = matcher.search(0, str.length, Option.DEFAULT);
if (result != -1) {
    Region region = matcher.getEagerRegion();
    for (Iterator<NameEntry> entry = regex.namedBackrefIterator(); entry.hasNext();) {
        NameEntry e = entry.next();
        int number = e.getBackRefs()[0]; // can have many refs per name
        // int begin = region.beg[number];
        // int end = region.end[number];
    }
}

License

Joni is released under the MIT License.

About

Java port of Oniguruma regexp library

Resources

Readme
MIT license
Activity
Custom properties

Stars

190 stars

Watchers

9 watching

Forks

92 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.