Regex Coach is a free cross-platform program that you can use to learn and work with regular expressions in a visual environment.
Regular expression can be used to identify strings of text. They are written in a formal language that looks hard to understand on first glance but follows strict rules. Most users associate regular expressions with programming languages, and while this is surely a dominant area, regular expressions are supported in text editors and other tools as well. One of the most popular is probably grep in Linux.
Regex Coach is an excellent software program to learn regular expressions using a graphical user interface and real-time results directly in the interface.
The interface itself is divided into two display panes: the first acts as an editor for regular expressions, the second holds a sample text which highlights matches based on the regular expression entered in the first. You can paste sample text into the second pane, or type it instead.
Below those two panes are tabs and buttons that provide additional functionality.
To test a regular expression, you'd do the following. You add a sample text to the target string field via copy and paste or by typing it directly.
Once the text is there, you add the regular expression. The program highlights matches automatically as you type which makes it easy to craft the right expression for the sample text. When you edit the regular expression or the text, results are automatically adjusted as well.
Invalid entries are displayed automatically as a status message. The program will for instance notify the user if a bracket has not been closed which would make the expression invalid.
What I like about the program in particular is the info field. It explains the regular expression that you have entered so that you can adjust it based on that as well.
The remaining tabs are also useful. Tree divides the expression into different parts, the replacing and splitting text options act like Perl's substitution and split operators, and the step tab allows you to see the regular expression at work.
The Regex Coach is a learning by doing tool for learning or verifying regular expressions. There is still need for a documentation on regular expressions like this one.
While it is useful to learn regular expressions, it can also be used to debug expressions or create new ones that include testing to make sure they work properly.
If you prefer to use an online tool, or are not using Windows, then you may want to try RegExr, a free service that offers a similar feature set but online.Advertisement
Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.
We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats or subscription fees.
If you like our content, and would like to help, please consider making a contribution:
Ghacks is a technology news blog that was founded in 2005 by Martin Brinkmann. It has since then become one of the most popular tech news sites on the Internet with five authors and regular contributions from freelance writers.