Regular Expressions, often called “regex,” are one of the most powerful tools in any programming language’s toolbox, at least when it comes to string handling. They can be a challenge to build and test if you’re working blind, though. There have been a few good apps to help out with this, and some websites that offer live, online testing of regular expressions.
A new app called Oyster from Red When Excited does an excellent job of bringing together some of the best features from other apps such as Patterns and RegexRX. It’s more robust than Patterns, prettier than RegexRX, and adds a few unique, useful features of its own.
It starts with syntax highlighting, which is not only pretty but very handy for catching errors in your code. It also highlights matches and capture groups dynamically as you type, so you can instantly see the results.
In addition to regular expression matching, it handles replacement testing, so you can instantly see the result of complex replacements, including those using capture groups from the original match.
Oyster keeps a library of your regular expressions for you. They’re referred to as Pearls, and can be exported, copied, or shared using the Oyster Farm, an online repository of Pearls from Oyster users. The Oyster Farm is a great place to search for a starting point before tweaking an expression to your needs.
Among the export and integration options, my favorite has to be the integration with Dash snippets. It’s the primary reason I’ve started using the snippet functionality in Dash (which I have long loved for its documentation capabilities).
Once you’ve tested and finalized a regular expression, it can be copied out in one of 11 different languages (including C#, Java, JavaScript, JSP, Obj-C, PHP, Ruby, Perl, Python and TCL/TK), with the syntax automatically converted to work in your current code.
There’s also a very handy reference guide you can view in a floating panel while you’re working. It has all the basics, and includes advanced syntax for things like lookaheads and backreferences.
Oyster is $4.99 US on the Mac App Store. If you work with regular expressions, I give this app a strong recommendation. Also check out Cloud Mate (an app for consolidating and accessing all of your iCloud files, also available for iOS) from the same developer!