RegExr 2.0 was released a little over 2 years ago. If you haven’t used it, it is a great way to test, preview, and share Regular Expressions. We’re committed to updating and improving RegExr, and in January we quietly pushed out some features to help inspect and explain patterns.
The New “Tools” Bar
Initially, RegExr only had one tool, the “substitution” panel, which let users show sample text with matches substituted using an expression. It was hidden by default, unless a pattern included a substitution expression. This tool has been renamed “replace”, and is now part of a larger “tools” bar, which we hope to continue growing in the future. In the meantime, it has a few other useful tools that I’ll describe below in more detail.
A List of Matches
An often-requested feature, the “list” panel shows just the list of matches, which can be customized with an expression. This provides a quick look at each full pattern match, as well as individual capture groups per match.
Details of Each Match
The match details was previously only discoverable by rolling over the match in the text panel at the top. A tooltip provided details such as the match text, the position in the text, and each capture group.
This works great for small matches, but could get unmanageable when matches had a lot of text or groups. The new panel shows a larger scrollable area and previews any match when it is clicked on. This also provides the opportunity to surface more information, such as the match number, length, and can more easily be selected and copied.
A Visual Explanation
Definitely the most requested feature is a better way to visualize a pattern, other than the text highlighting that RegExr has used since day one. While some tools have taken a very visual route, with a flow-chart-like diagram, RegExr has added a very useful hierarchical table, which breaks down the pattern into its components, and explains each one. We believe this highly-descriptive format is a great way to explain the pattern.
This latest release also has a ton of bug fixes, and we removed the reliance on Flash for copy/paste. If you are the curious type, check out the RegExr repository in GitHub for a full history of changes. RegExr is open source, so we hope you will poke around, fork it, and maybe even make contributions of your own!