Chimera4j allows you to run full PCRE compliant regexes in the JVM (up to 8 times faster than native PCRE). It is essentially just a wrapper for Chimera. Currently, the project is a bit of a super hacky prototype, but it is tested fairly well and appears to work... so that's kinda nice.
This project is based off the fine work of the folks over at hyperscan-java, which is a wrapper for Hyperscan.
compile 'com.rivdata:Chimera4j:0.2.0'
libraryDependencies += "com.rivdata" % "Chimera4j" % "0.2.0"
Check out the tests.
Code is just a proof of concept that we can use Hyperscan 5 and Chimera with Java. We need to validate that's compatible with all PCRE regexes before committing to a full development.
Be wary of the following pitfalls:
- Be afraid of the natives. I built the darwin ones on my personal computer, the linux ones I built in docker. If you get any errors, these natives are likely the cause. Since they run very differently depending on the hardware you are running on, make sure to test your production environments, or better yet, keep this library out of production altogether.
- The
libchimera.so
andlibchimera.dylib
filenames are a bit misleading. In truth, they are actually dynamic libs that link chimera, hyperscan and PCRE together into a FAT executable. - The pure Hyperscan
.dylib
file in here is useless, but I'm leaving it in because the code references it in a ton of places. All the functionality it provides is duplicated in thechimera.dylib
.