
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
me.zolotov.oniguruma:oniguruma-jni
Advanced tools
A JNI wrapper for the Oniguruma regular expression library, with Rust implementation using the onig crate. This library is primarily designed to support syntax highlighting in IntelliJ-based IDEs through the textmate-core library.
A JNI wrapper for the Oniguruma regular expression library, with Rust implementation using the onig crate.
This library is primarily designed to support syntax highlighting in IntelliJ-based IDEs through the textmate-core library.
This project provides Java Native Interface (JNI) bindings for TextMate grammar pattern matching,
implemented in Rust using the onig crate which provides the native bindings to the Oniguruma regular expression library.
Add the following dependency to your project:
dependencies {
implementation("me.zolotov.oniguruma:oniguruma-jni:$version")
}
// Load the library from bundled resources
// Note: This method has performance overhead during instantiation (unpacking a native part from jar)
// and JVM shutdown (cleanup hook to remove the unpacked file)
val oniguruma = Oniguruma.createFromResources()
// Or load from a specific file path (preferred for better performance)
val oniguruma = Oniguruma.createFromFile(Path.of("/path/to/library"))
val oniguruma = Oniguruma.createFromResources()
// Create pattern and string handles
val pattern = "pattern".toByteArray()
val text = "text to match".toByteArray()
val textPtr = oniguruma.createString(text)
try {
val regexPtr = oniguruma.createRegex(pattern)
try {
val result = oniguruma.match(
regexPtr = regexPtr,
textPtr = textPtr,
byteOffset = 0,
matchBeginPosition = true,
matchBeginString = false
)
// Process results
result?.let {
// Match found, process the integer array of positions
it.asSequence()?.windowed(size = 2, step = 2, partialWindows = false) { (startByteOffset, endByteOffset) ->
}
}
} finally {
// Clean up native regex
oniguruma.freeRegex(regexPtr)
}
} finally {
// Clean up native string
oniguruma.freeString(textPtr)
}
./gradlew build
Contributions are welcome! Please feel free to submit pull requests.
This library is primarily intended for use with the textmate-core library in IntelliJ-based IDEs. While it can be used independently, the API is designed with this specific use case in mind.
FAQs
Unknown package
We found that me.zolotov.oniguruma:oniguruma-jni demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.