Fork me on GitHub


Welcome to the objexj project. objexj implements regular expression concepts but using arbitrary Java objects as the input. This means you can write patterns that match sequences of Java objects, not just sequences of characters.


Why make this library? I was looking for a programmatic way to match Exception stacks in the same way that we flawed humans do when diagnosing errors. Typically we walk the stack and make decisions about what kind of problem it represents based on what kinds of exceptions we see in what order. For example, a big complicated exception stack that ends with a PersistenceException caused by a SQLException with a particular SQL state tells us pretty definitively what happened. My thought was if I could implement this diagnostic activity somehow on top of the actual Exceptions in the stack—not just the textual representations—then I could come up with a localized error message that was much more informative than would otherwise be possible.

Giant Shoulders

This library is only possible because of Russ Cox and Eric Lippert.


The syntax used by objexj is heavily inspired by “normal” regular expression syntax. See the Syntax Guide for more information.


This library has applications in error analysis (building messages for chains of Throwables), stream processing, event processing and other pattern-recognition-related domains.

API Documentation

The API is fully documented. Please see the API documentation to get started.