RE2/J is a high-performance regular expression engine implemented in pure Java as a port of Google’s C++ RE2 library. Unlike traditional regex engines such as Java’s java.util.regex, PCRE, or Perl’s implementation—which rely on backtracking and can suffer from catastrophic exponential runtimes—RE2/J guarantees linear-time matching relative to input size. It achieves this efficiency by simulating all possible matches in a single pass using a nondeterministic finite automaton (NFA), ensuring predictable and safe performance even with complex patterns. This makes RE2/J ideal for applications that must handle user-supplied regular expressions securely without the risk of denial-of-service through regex backtracking. While it omits some advanced features like backreferences and certain Java regex options, it supports the vast majority of practical expressions used in production code. RE2/J thus provides a reliable, safe, and scalable alternative for developers.

Features

  • Linear-time regular expression matching regardless of input size
  • Implemented entirely in Java as a port of Google’s C++ RE2 engine
  • Immune to catastrophic backtracking and stack overflows
  • Compatible with most Java regular expression syntax and behavior
  • Designed for safety when handling untrusted regex patterns
  • Easily integrated via Maven or direct JAR inclusion in Java projects

Project Samples

Project Activity

See All Activity >

Categories

Libraries

License

BSD License

Follow RE2/J

RE2/J Web Site

You Might Also Like
All-in-One IT Monitoring - No More Blind Spots Icon
All-in-One IT Monitoring - No More Blind Spots

Stop juggling tools. PRTG gives you a complete, real-time view of your IT: servers, devices, cloud, and more - in one easy dashboard.

Tired of switching between different tools and missing critical alerts? PRTG brings everything together, monitoring your entire IT infrastructure from a single, intuitive interface. Whether it’s servers, switches, printers, or cloud services, you get instant visibility and clear notifications - no technical jargon, no clutter. Set up in minutes, PRTG helps you prevent downtime, reduce stress, and prove your value to your company. Focus on your job, not on chasing issues. Try PRTG and experience true IT peace of mind.
Get Your Unified IT Trial
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of RE2/J!

Additional Project Details

Operating Systems

Linux, Mac, Windows

Programming Language

Java, Perl

Related Categories

Perl Libraries, Java Libraries

Registered

2025-10-11